-
Notifications
You must be signed in to change notification settings - Fork 33
feat: add slack docs search subcommand #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
f248043
94c8a90
d7bbb84
727d7ce
e1b0d80
4985713
91b5ac5
086b9e5
2bf8133
47613d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,136 @@ | ||||||
| // Copyright 2022-2026 Salesforce, Inc. | ||||||
| // | ||||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| // you may not use this file except in compliance with the License. | ||||||
| // You may obtain a copy of the License at | ||||||
| // | ||||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| // | ||||||
| // Unless required by applicable law or agreed to in writing, software | ||||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
| // See the License for the specific language governing permissions and | ||||||
| // limitations under the License. | ||||||
|
|
||||||
| package docs | ||||||
|
|
||||||
| import ( | ||||||
| "context" | ||||||
| "encoding/json" | ||||||
| "fmt" | ||||||
| "net/http" | ||||||
| "net/url" | ||||||
| "os" | ||||||
| "strings" | ||||||
|
|
||||||
| "github.com/slackapi/slack-cli/internal/shared" | ||||||
| "github.com/slackapi/slack-cli/internal/slacktrace" | ||||||
| "github.com/slackapi/slack-cli/internal/style" | ||||||
| "github.com/spf13/cobra" | ||||||
| ) | ||||||
|
|
||||||
| const docsSearchAPIURL = "https://docs-slack-d-search-api-duu9zr.herokuapp.com/api/search" | ||||||
|
||||||
| const docsSearchAPIURL = "https://docs-slack-d-search-api-duu9zr.herokuapp.com/api/search" | |
| const docsURL = "https://docs-slack-d-search-api-duu9zr.herokuapp.com/" |
🪬 suggestion: We might want to abstract this to the docs/docs.go file since we target it in multiple places? It might be useful for testing changes too?
lukegalbraithrussell marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
lukegalbraithrussell marked this conversation as resolved.
Show resolved
Hide resolved
lukegalbraithrussell marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be nice if URLs were full https://docs.slack.dev URLs so they're cmd+clickable in the terminal
{
"url": "https://docs.slack.dev/block-kit/",
"title": "Block Kit"
},right now the json outputs as
{
"url": "/block-kit/",
"title": "Block Kit"
},There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📚 thought: I agree listing entire links is ideal and might suggest we add a text format with this?
$ slack docs search "Block Kit" --output=text👾 ramble: If this format is supported it seems awkward to write that flag instead of defaulting to it but this is personal preference I think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔭 suggestion: Let's prefer to hide deprecated features!