No need to use a map

This commit is contained in:
Kovid Goyal 2022-09-27 11:18:29 +05:30
parent 3bd4fd999a
commit 2633356842
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 2 deletions

View File

@ -285,7 +285,11 @@ func get_password(password string, password_file string, password_env string, us
return ans, nil
}
var all_commands map[string]func(*cli.Command) *cli.Command = make(map[string]func(*cli.Command) *cli.Command)
var all_commands []func(*cli.Command) *cli.Command = make([]func(*cli.Command) *cli.Command, 0, 64)
func register_at_cmd(f func(*cli.Command) *cli.Command) {
all_commands = append(all_commands, f)
}
func setup_global_options(cmd *cli.Command) (err error) {
err = cmd.GetOptionValues(&rc_global_opts)

View File

@ -106,5 +106,5 @@ func setup_CMD_NAME(parent *cli.Command) *cli.Command {
}
func init() {
all_commands["CMD_NAME"] = setup_CMD_NAME
register_at_cmd(setup_CMD_NAME)
}