Get bool set flags ported

This commit is contained in:
Kovid Goyal
2022-08-17 09:34:03 +05:30
parent 15ffd8e6d8
commit 3a87cfce3e
3 changed files with 50 additions and 11 deletions

View File

@@ -19,6 +19,13 @@ import (
"kitty/tools/utils"
)
func add_bool_set(cmd *cobra.Command, name string, short string, usage string) *bool {
if short == "" {
return cmd.Flags().Bool(name, false, usage)
}
return cmd.Flags().BoolP(name, short, false, usage)
}
type GlobalOptions struct {
to_address, password string
to_address_is_from_env_var bool

View File

@@ -13,8 +13,13 @@ import (
func run_CMD_NAME(cmd *cobra.Command, args []string) (err error) {
rc := utils.RemoteControlCmd{
Cmd: "CLI_NAME",
Version: [3]int{0, 20, 0},
Cmd: "CLI_NAME",
Version: [3]int{0, 20, 0},
NoResponse: NO_RESPONSE_BASE,
}
nrv, err := cmd.Flags().GetBool("no-response")
if err == nil {
rc.NoResponse = nrv
}
err = send_rc_command(&rc)
return
@@ -27,6 +32,7 @@ func setup_CMD_NAME(root *cobra.Command) *cobra.Command {
Long: "LONG_DESC",
RunE: run_CMD_NAME,
})
ADD_FLAGS_CODE
return ans
}