Create hidden alias commands so kitty-tool @ls also works
This commit is contained in:
parent
d3bb69a0ac
commit
bab914c497
@ -17,7 +17,7 @@ def serialize_as_go_string(x: str) -> str:
|
||||
|
||||
|
||||
def build_go_code(name: str, cmd: RemoteCommand, opts: Any, template: str) -> str:
|
||||
template = template[len('//go:build exclude'):]
|
||||
template = '\n' + template[len('//go:build exclude'):]
|
||||
ans = template.replace('CMD_NAME', name).replace('__FILE__', __file__).replace('CLI_NAME', name.replace('_', '-')).replace(
|
||||
'SHORT_DESC', serialize_as_go_string(cmd.short_desc)).replace('LONG_DESC', serialize_as_go_string(cmd.desc.strip()))
|
||||
return ans
|
||||
|
||||
@ -121,6 +121,10 @@ func EntryPoint(tool_root *cobra.Command) *cobra.Command {
|
||||
c := reg_func(at_root_command)
|
||||
at_root_command.AddCommand(c)
|
||||
command_objects[cmd_name] = c
|
||||
alias := *c
|
||||
alias.Use = "@" + alias.Use
|
||||
alias.Hidden = true
|
||||
tool_root.AddCommand(&alias)
|
||||
}
|
||||
return at_root_command
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user