-
Notifications
You must be signed in to change notification settings - Fork 42
fix: use docs site paths for command reference See also links #642
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8964ac1
fix: use docs site paths for command reference See also links
lukegalbraithrussell 350abf2
test: cover docs site paths for reference See also links
lukegalbraithrussell 791f695
Merge branch 'main' into docs-reference-links
lukegalbraithrussell 2b594ad
Merge branch 'main' into docs-reference-links
lukegalbraithrussell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| package docgen | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "context" | ||
| "errors" | ||
| "path/filepath" | ||
|
|
@@ -171,3 +172,47 @@ func TestNewDocsCommand(t *testing.T) { | |
| return NewCommand(clients) | ||
| }) | ||
| } | ||
|
|
||
| func Test_commandDocsURL(t *testing.T) { | ||
| tests := map[string]struct { | ||
| commandPath string | ||
| expected string | ||
| }{ | ||
| "root command": { | ||
| commandPath: "slack", | ||
| expected: "/tools/slack-cli/reference/commands/slack/", | ||
| }, | ||
| "subcommand replaces spaces with underscores": { | ||
| commandPath: "slack app", | ||
| expected: "/tools/slack-cli/reference/commands/slack_app/", | ||
| }, | ||
| "nested subcommand": { | ||
| commandPath: "slack app delete", | ||
| expected: "/tools/slack-cli/reference/commands/slack_app_delete/", | ||
| }, | ||
| } | ||
| for name, tc := range tests { | ||
| t.Run(name, func(t *testing.T) { | ||
| assert.Equal(t, tc.expected, commandDocsURL(tc.commandPath)) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func Test_genMarkdownCommand(t *testing.T) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👁️🗨️ note: I'm more curious if this can be added to an existing test case above but we can keep this in mind for ongoing changes too. |
||
| root := &cobra.Command{Use: "slack", Short: "Slack command-line tool"} | ||
| app := &cobra.Command{Use: "app", Short: "App management commands", Run: func(*cobra.Command, []string) {}} | ||
| del := &cobra.Command{Use: "delete", Short: "Delete the app", Run: func(*cobra.Command, []string) {}} | ||
| app.AddCommand(del) | ||
| root.AddCommand(app) | ||
|
|
||
| var buf bytes.Buffer | ||
| require.NoError(t, genMarkdownCommand(app, &buf)) | ||
| output := buf.String() | ||
|
|
||
| assert.Contains(t, output, "## See also") | ||
| // Parent link uses the docs site path rather than a bare slug. | ||
| assert.Contains(t, output, "* [slack](/tools/slack-cli/reference/commands/slack/)") | ||
| // Child link uses the docs site path rather than a bare slug. | ||
| assert.Contains(t, output, "* [slack app delete](/tools/slack-cli/reference/commands/slack_app_delete/)") | ||
| assert.NotContains(t, output, "](slack_app_delete)") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # `slack blocks` | ||
|
|
||
| Build with Block Kit | ||
|
|
||
| ## Description | ||
|
|
||
| Build layouts using Block Kit and iterate on designs with Block Kit Builder. | ||
|
|
||
| ``` | ||
| slack blocks <subcommand> [flags] | ||
| ``` | ||
|
|
||
| ## Flags | ||
|
|
||
| ``` | ||
| -h, --help help for blocks | ||
| ``` | ||
|
|
||
| ## Global flags | ||
|
|
||
| ``` | ||
| --accessible use accessible prompts for screen readers | ||
| -a, --app string use a specific app ID or environment | ||
| --config-dir string use a custom path for system config directory | ||
| -e, --experiment strings use the experiment(s) in the command | ||
| -f, --force ignore warnings and continue executing command | ||
| --no-color remove styles and formatting from outputs | ||
| -s, --skip-update skip checking for latest version of CLI | ||
| -w, --team string select workspace or organization by team name or ID | ||
| --token string set the access token associated with a team | ||
| -v, --verbose print debug logging and additional info | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ``` | ||
| # Preview blocks in Block Kit Builder | ||
| $ slack blocks preview --blocks '[{"type":"divider"}]' | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| * [slack](/tools/slack-cli/reference/commands/slack/) - Slack command-line tool | ||
| * [slack blocks preview](/tools/slack-cli/reference/commands/slack_blocks_preview/) - Preview blocks in Block Kit Builder | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # `slack blocks preview` | ||
|
|
||
| Preview blocks in Block Kit Builder | ||
|
|
||
| ## Description | ||
|
|
||
| Preview a set of Block Kit blocks with Block Kit Builder in a web browser. | ||
|
|
||
| Provide blocks with the --blocks flag. | ||
| The input is a JSON array of blocks or a JSON object with a "blocks" array. | ||
| Pass - to --blocks, or omit all flags, to read from standard input. | ||
|
|
||
| ``` | ||
| slack blocks preview [flags] | ||
| ``` | ||
|
|
||
| ## Flags | ||
|
|
||
| ``` | ||
| --blocks string blocks to preview as a JSON array or object | ||
| (use - to read from standard input) | ||
| -h, --help help for preview | ||
| ``` | ||
|
|
||
| ## Global flags | ||
|
|
||
| ``` | ||
| --accessible use accessible prompts for screen readers | ||
| -a, --app string use a specific app ID or environment | ||
| --config-dir string use a custom path for system config directory | ||
| -e, --experiment strings use the experiment(s) in the command | ||
| -f, --force ignore warnings and continue executing command | ||
| --no-color remove styles and formatting from outputs | ||
| -s, --skip-update skip checking for latest version of CLI | ||
| -w, --team string select workspace or organization by team name or ID | ||
| --token string set the access token associated with a team | ||
| -v, --verbose print debug logging and additional info | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ``` | ||
| # Preview blocks passed as a flag value | ||
| $ slack blocks preview --blocks '[{"type":"divider"}]' | ||
|
|
||
| # Preview blocks read from a file | ||
| $ slack blocks preview < blocks.json | ||
|
|
||
| # Preview blocks read from a redirect and scoped to a team | ||
| $ slack blocks preview --team T0123456 --blocks - < blocks.json | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| * [slack blocks](/tools/slack-cli/reference/commands/slack_blocks/) - Build with Block Kit | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧪 🏆 praise: Thanks for keeping this confident!
🎁 note: I'm unsure if
docgenor the internaldocspackage is better for these patterns and test but for now it's no blocker!