Docs: Improve usage and help documents for kitten

This commit is contained in:
pagedown 2023-02-01 17:14:54 +08:00
parent 682428fb54
commit 8fe936882d
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB
3 changed files with 5 additions and 3 deletions

View File

@ -110,6 +110,8 @@ func show_basic_help() {
fmt.Fprintln(&output, " ", sc.ShortDescription) fmt.Fprintln(&output, " ", sc.ShortDescription)
} }
} }
fmt.Fprintln(&output, " ", formatter.Green("help"))
fmt.Fprintln(&output, " ", "Show this help")
fmt.Fprintln(&output, " ", formatter.Green("exit")) fmt.Fprintln(&output, " ", formatter.Green("exit"))
fmt.Fprintln(&output, " ", "Exit this shell") fmt.Fprintln(&output, " ", "Exit this shell")
cli.ShowHelpInPager(output.String()) cli.ShowHelpInPager(output.String())

View File

@ -87,7 +87,7 @@ func EntryPoint(tool_root *cli.Command) {
Name: "__complete__", Hidden: true, Name: "__complete__", Hidden: true,
Usage: "output_type [shell state...]", Usage: "output_type [shell state...]",
ShortDescription: "Generate completions for kitty commands", ShortDescription: "Generate completions for kitty commands",
HelpText: "Generate completion candidates for kitty commands. The command line is read from STDIN. output_type can be one of the supported shells or 'json' for JSON output.", HelpText: "Generate completion candidates for kitty commands. The command line is read from STDIN. output_type can be one of the supported shells or :code:`json` for JSON output.",
Run: func(cmd *cli.Command, args []string) (ret int, err error) { Run: func(cmd *cli.Command, args []string) (ret int, err error) {
return ret, cli.GenerateCompletions(args) return ret, cli.GenerateCompletions(args)
}, },

View File

@ -71,7 +71,7 @@ func update_self(version string) (err error) {
func EntryPoint(root *cli.Command) *cli.Command { func EntryPoint(root *cli.Command) *cli.Command {
sc := root.AddSubCommand(&cli.Command{ sc := root.AddSubCommand(&cli.Command{
Name: "update-self", Name: "update-self",
Usage: "update-self [options ...]", Usage: "[options]",
ShortDescription: "Update this kitten binary", ShortDescription: "Update this kitten binary",
HelpText: "Update this kitten binary in place to the latest available version.", HelpText: "Update this kitten binary in place to the latest available version.",
Run: func(cmd *cli.Command, args []string) (ret int, err error) { Run: func(cmd *cli.Command, args []string) (ret int, err error) {
@ -89,7 +89,7 @@ func EntryPoint(root *cli.Command) *cli.Command {
sc.Add(cli.OptionSpec{ sc.Add(cli.OptionSpec{
Name: "--fetch-version", Name: "--fetch-version",
Default: "latest", Default: "latest",
Help: "The version to fetch. The special words :code:`latest` and :code:`nightly` fetch the latest stable and nightly release respectively. Other values can be, for example: 0.27.1.", Help: fmt.Sprintf("The version to fetch. The special words :code:`latest` and :code:`nightly` fetch the latest stable and nightly release respectively. Other values can be, for example: :code:`%s`.", kitty.VersionString),
}) })
return sc return sc
} }