From dcb405a9399ed307eaa0e50f5cb1c290c8979dd4 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> Date: Tue, 20 Jun 2023 22:15:36 +0100 Subject: [PATCH] Move documentation sources to site/content (#1428) --- README.md | 8 ++++---- fish_completions.md | 4 ---- powershell_completions.md | 3 --- active_help.md => site/content/active_help.md | 0 .../content/completions/_index.md | 12 ++++++------ .../content/completions/bash.md | 2 +- site/content/completions/fish.md | 4 ++++ site/content/completions/powershell.md | 3 +++ .../content/completions/zsh.md | 2 +- doc/README.md => site/content/docgen/_index.md | 8 ++++---- doc/man_docs.md => site/content/docgen/man.md | 0 doc/md_docs.md => site/content/docgen/md.md | 0 doc/rest_docs.md => site/content/docgen/rest.md | 0 doc/yaml_docs.md => site/content/docgen/yaml.md | 0 .../content/projects_using_cobra.md | 0 user_guide.md => site/content/user_guide.md | 15 ++++++++++----- 16 files changed, 33 insertions(+), 28 deletions(-) delete mode 100644 fish_completions.md delete mode 100644 powershell_completions.md rename active_help.md => site/content/active_help.md (100%) rename shell_completions.md => site/content/completions/_index.md (98%) rename bash_completions.md => site/content/completions/bash.md (98%) create mode 100644 site/content/completions/fish.md create mode 100644 site/content/completions/powershell.md rename zsh_completions.md => site/content/completions/zsh.md (98%) rename doc/README.md => site/content/docgen/_index.md (73%) rename doc/man_docs.md => site/content/docgen/man.md (100%) rename doc/md_docs.md => site/content/docgen/md.md (100%) rename doc/rest_docs.md => site/content/docgen/rest.md (100%) rename doc/yaml_docs.md => site/content/docgen/yaml.md (100%) rename projects_using_cobra.md => site/content/projects_using_cobra.md (100%) rename user_guide.md => site/content/user_guide.md (97%) diff --git a/README.md b/README.md index 592c0b8..6444f4b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Cobra is a library for creating powerful modern CLI applications. Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/), [Hugo](https://gohugo.io), and [GitHub CLI](https://github.com/cli/cli) to -name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra. +name a few. [This list](site/content/projects_using_cobra.md) contains a more extensive list of projects using Cobra. [![](https://img.shields.io/github/actions/workflow/status/spf13/cobra/test.yml?branch=main&longCache=true&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest) [![Go Reference](https://pkg.go.dev/badge/github.com/spf13/cobra.svg)](https://pkg.go.dev/github.com/spf13/cobra) @@ -80,7 +80,7 @@ which maintains the same interface while adding POSIX compliance. # Installing Using Cobra is easy. First, use `go get` to install the latest version -of the library. +of the library. ``` go get -u github.com/spf13/cobra@latest @@ -105,8 +105,8 @@ go install github.com/spf13/cobra-cli@latest For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) -For complete details on using the Cobra library, please read the [The Cobra User Guide](user_guide.md). +For complete details on using the Cobra library, please read the [The Cobra User Guide](site/content/user_guide.md). # License -Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) +Cobra is released under the Apache 2.0 license. See [LICENSE.txt](LICENSE.txt) diff --git a/fish_completions.md b/fish_completions.md deleted file mode 100644 index 19b2ed1..0000000 --- a/fish_completions.md +++ /dev/null @@ -1,4 +0,0 @@ -## Generating Fish Completions For Your cobra.Command - -Please refer to [Shell Completions](shell_completions.md) for details. - diff --git a/powershell_completions.md b/powershell_completions.md deleted file mode 100644 index c449f1e..0000000 --- a/powershell_completions.md +++ /dev/null @@ -1,3 +0,0 @@ -# Generating PowerShell Completions For Your Own cobra.Command - -Please refer to [Shell Completions](shell_completions.md#powershell-completions) for details. diff --git a/active_help.md b/site/content/active_help.md similarity index 100% rename from active_help.md rename to site/content/active_help.md diff --git a/shell_completions.md b/site/content/completions/_index.md similarity index 98% rename from shell_completions.md rename to site/content/completions/_index.md index 065c062..4efad29 100644 --- a/shell_completions.md +++ b/site/content/completions/_index.md @@ -416,7 +416,7 @@ completion firstcommand secondcommand ### Bash legacy dynamic completions For backward compatibility, Cobra still supports its bash legacy dynamic completion solution. -Please refer to [Bash Completions](bash_completions.md) for details. +Please refer to [Bash Completions](bash.md) for details. ### Bash completion V2 @@ -425,13 +425,13 @@ Cobra provides two versions for bash completion. The original bash completion ( A new V2 bash completion version is also available. This version can be used by calling `GenBashCompletionV2()` or `GenBashCompletionFileV2()`. The V2 version does **not** support the legacy dynamic completion -(see [Bash Completions](bash_completions.md)) but instead works only with the Go dynamic completion +(see [Bash Completions](bash.md)) but instead works only with the Go dynamic completion solution described in this document. Unless your program already uses the legacy dynamic completion solution, it is recommended that you use the bash completion V2 solution which provides the following extra features: - Supports completion descriptions (like the other shells) - Small completion script of less than 300 lines (v1 generates scripts of thousands of lines; `kubectl` for example has a bash v1 completion script of over 13K lines) -- Streamlined user experience thanks to a completion behavior aligned with the other shells +- Streamlined user experience thanks to a completion behavior aligned with the other shells `Bash` completion V2 supports descriptions for completions. When calling `GenBashCompletionV2()` or `GenBashCompletionFileV2()` you must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra @@ -448,7 +448,7 @@ show (show information of a chart) $ helm s[tab][tab] search show status ``` -**Note**: Cobra's default `completion` command uses bash completion V2. If for some reason you need to use bash completion V1, you will need to implement your own `completion` command. +**Note**: Cobra's default `completion` command uses bash completion V2. If for some reason you need to use bash completion V1, you will need to implement your own `completion` command. ## Zsh completions Cobra supports native zsh completion generated from the root `cobra.Command`. @@ -482,7 +482,7 @@ search show status ### Zsh completions standardization Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backward-compatible, some small changes in behavior were introduced. -Please refer to [Zsh Completions](zsh_completions.md) for details. +Please refer to [Zsh Completions](zsh.md) for details. ## fish completions @@ -535,7 +535,7 @@ search (search for a keyword in charts) show (show information of a chart) s # With descriptions and Mode 'MenuComplete' The description of the current selected value will be displayed below the suggestions. $ helm s[tab] -search show status +search show status search for a keyword in charts diff --git a/bash_completions.md b/site/content/completions/bash.md similarity index 98% rename from bash_completions.md rename to site/content/completions/bash.md index 52919b2..6838a3a 100644 --- a/bash_completions.md +++ b/site/content/completions/bash.md @@ -1,6 +1,6 @@ # Generating Bash Completions For Your cobra.Command -Please refer to [Shell Completions](shell_completions.md) for details. +Please refer to [Shell Completions](_index.md) for details. ## Bash legacy dynamic completions diff --git a/site/content/completions/fish.md b/site/content/completions/fish.md new file mode 100644 index 0000000..5253f7d --- /dev/null +++ b/site/content/completions/fish.md @@ -0,0 +1,4 @@ +## Generating Fish Completions For Your cobra.Command + +Please refer to [Shell Completions](_index.md) for details. + diff --git a/site/content/completions/powershell.md b/site/content/completions/powershell.md new file mode 100644 index 0000000..024b119 --- /dev/null +++ b/site/content/completions/powershell.md @@ -0,0 +1,3 @@ +# Generating PowerShell Completions For Your Own cobra.Command + +Please refer to [Shell Completions](_index.md#powershell-completions) for details. diff --git a/zsh_completions.md b/site/content/completions/zsh.md similarity index 98% rename from zsh_completions.md rename to site/content/completions/zsh.md index 7cff617..3e27208 100644 --- a/zsh_completions.md +++ b/site/content/completions/zsh.md @@ -1,6 +1,6 @@ ## Generating Zsh Completion For Your cobra.Command -Please refer to [Shell Completions](shell_completions.md) for details. +Please refer to [Shell Completions](_index.md) for details. ## Zsh completions standardization diff --git a/doc/README.md b/site/content/docgen/_index.md similarity index 73% rename from doc/README.md rename to site/content/docgen/_index.md index 8e07baa..eba2a5f 100644 --- a/doc/README.md +++ b/site/content/docgen/_index.md @@ -1,9 +1,9 @@ # Documentation generation -- [Man page docs](./man_docs.md) -- [Markdown docs](./md_docs.md) -- [Rest docs](./rest_docs.md) -- [Yaml docs](./yaml_docs.md) +- [Man page docs](man.md) +- [Markdown docs](md.md) +- [Rest docs](rest.md) +- [Yaml docs](yaml.md) ## Options ### `DisableAutoGenTag` diff --git a/doc/man_docs.md b/site/content/docgen/man.md similarity index 100% rename from doc/man_docs.md rename to site/content/docgen/man.md diff --git a/doc/md_docs.md b/site/content/docgen/md.md similarity index 100% rename from doc/md_docs.md rename to site/content/docgen/md.md diff --git a/doc/rest_docs.md b/site/content/docgen/rest.md similarity index 100% rename from doc/rest_docs.md rename to site/content/docgen/rest.md diff --git a/doc/yaml_docs.md b/site/content/docgen/yaml.md similarity index 100% rename from doc/yaml_docs.md rename to site/content/docgen/yaml.md diff --git a/projects_using_cobra.md b/site/content/projects_using_cobra.md similarity index 100% rename from projects_using_cobra.md rename to site/content/projects_using_cobra.md diff --git a/user_guide.md b/site/content/user_guide.md similarity index 97% rename from user_guide.md rename to site/content/user_guide.md index 85201d8..0497143 100644 --- a/user_guide.md +++ b/site/content/user_guide.md @@ -29,8 +29,8 @@ func main() { ## Using the Cobra Generator -Cobra-CLI is its own program that will create your application and add any -commands you want. It's the easiest way to incorporate Cobra into your application. +Cobra-CLI is its own program that will create your application and add any commands you want. +It's the easiest way to incorporate Cobra into your application. For complete details on using the Cobra generator, please refer to [The Cobra-CLI Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md) @@ -715,12 +715,17 @@ Run 'kubectl help' for usage. ## Generating documentation for your command -Cobra can generate documentation based on subcommands, flags, etc. Read more about it in the [docs generation documentation](doc/README.md). +Cobra can generate documentation based on subcommands, flags, etc. +Read more about it in the [docs generation documentation](docgen/_index.md). ## Generating shell completions -Cobra can generate a shell-completion file for the following shells: bash, zsh, fish, PowerShell. If you add more information to your commands, these completions can be amazingly powerful and flexible. Read more about it in [Shell Completions](shell_completions.md). +Cobra can generate a shell-completion file for the following shells: bash, zsh, fish, PowerShell. +If you add more information to your commands, these completions can be amazingly powerful and flexible. +Read more about it in [Shell Completions](completions/_index.md). ## Providing Active Help -Cobra makes use of the shell-completion system to define a framework allowing you to provide Active Help to your users. Active Help are messages (hints, warnings, etc) printed as the program is being used. Read more about it in [Active Help](active_help.md). +Cobra makes use of the shell-completion system to define a framework allowing you to provide Active Help to your users. +Active Help are messages (hints, warnings, etc) printed as the program is being used. +Read more about it in [Active Help](active_help.md).