mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-11 18:32:12 +02:00
Generate man pages for kitten and all its sub-commands recursively
Fixes #6808
This commit is contained in:
@@ -20,7 +20,8 @@ func main() {
|
||||
return
|
||||
}
|
||||
root := cli.NewRootCommand()
|
||||
root.ShortDescription = "Fast, statically compiled implementations for various kittens (command line tools for use with kitty)"
|
||||
root.ShortDescription = "Fast, statically compiled implementations of various kittens (command line tools for use with kitty)"
|
||||
root.HelpText = "kitten serves as a launcher for running individual kittens. Each kitten can be run as :code:`kitten command`. The list of available kittens is given below."
|
||||
root.Usage = "command [command options] [command args]"
|
||||
root.Run = func(cmd *cli.Command, args []string) (int, error) {
|
||||
cmd.ShowHelp()
|
||||
|
||||
@@ -96,4 +96,29 @@ func KittyToolEntryPoints(root *cli.Command) {
|
||||
return confirm_and_run_shebang(args)
|
||||
},
|
||||
})
|
||||
// __generate_man_pages__
|
||||
root.AddSubCommand(&cli.Command{
|
||||
Name: "__generate_man_pages__",
|
||||
Hidden: true,
|
||||
OnlyArgsAllowed: true,
|
||||
Run: func(cmd *cli.Command, args []string) (rc int, err error) {
|
||||
q := root
|
||||
if len(args) > 0 {
|
||||
for _, scname := range args {
|
||||
sc := q.FindSubCommand(scname)
|
||||
if sc == nil {
|
||||
return 1, fmt.Errorf("No sub command named: %s found", scname)
|
||||
}
|
||||
if err = sc.GenerateManPages(1, true); err != nil {
|
||||
return 1, err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err = q.GenerateManPages(1, false); err != nil {
|
||||
rc = 1
|
||||
}
|
||||
}
|
||||
return
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user