mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
Make adding subcommands a bit nicer
This commit is contained in:
@@ -311,10 +311,12 @@ func setup_global_options(cmd *cli.Command) (err error) {
|
||||
}
|
||||
|
||||
func EntryPoint(tool_root *cli.Command) *cli.Command {
|
||||
at_root_command := tool_root.AddSubCommand("", "@")
|
||||
at_root_command.Usage = "[global options] [sub-command] [sub-command options] [sub-command args]"
|
||||
at_root_command.ShortDescription = "Control kitty remotely"
|
||||
at_root_command.HelpText = "Control kitty by sending it commands. Set the allow_remote_control option in :file:`kitty.conf` for this to work. When run without any sub-commands this will start an interactive shell to control kitty."
|
||||
at_root_command := tool_root.AddSubCommand(&cli.Command{
|
||||
Name: "@",
|
||||
Usage: "[global options] [sub-command] [sub-command options] [sub-command args]",
|
||||
ShortDescription: "Control kitty remotely",
|
||||
HelpText: "Control kitty by sending it commands. Set the allow_remote_control option in :file:`kitty.conf` for this to work. When run without any sub-commands this will start an interactive shell to control kitty.",
|
||||
})
|
||||
add_rc_global_opts(at_root_command)
|
||||
|
||||
global_options_group := at_root_command.OptionGroups[0]
|
||||
|
||||
@@ -94,11 +94,13 @@ func run_CMD_NAME(cmd *cli.Command, args []string) (return_code int, err error)
|
||||
}
|
||||
|
||||
func setup_CMD_NAME(parent *cli.Command) *cli.Command {
|
||||
ans := parent.AddSubCommand("", "CMD_NAME")
|
||||
ans.Usage = "ARGSPEC"
|
||||
ans.ShortDescription = "SHORT_DESC"
|
||||
ans.HelpText = "LONG_DESC"
|
||||
ans.Run = run_CMD_NAME
|
||||
ans := parent.AddSubCommand(&cli.Command{
|
||||
Name: "CMD_NAME",
|
||||
Usage: "ARGSPEC",
|
||||
ShortDescription: "SHORT_DESC",
|
||||
HelpText: "LONG_DESC",
|
||||
Run: run_CMD_NAME,
|
||||
})
|
||||
ADD_FLAGS_CODE
|
||||
return ans
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user