Pulak Kanti Bhowmick
10/31/2024, 6:53 AMAndriy Knysh (Cloud Posse)
10/31/2024, 12:15 PMAndriy Knysh (Cloud Posse)
10/31/2024, 12:19 PMAndriy Knysh (Cloud Posse)
10/31/2024, 12:19 PMAndriy Knysh (Cloud Posse)
10/31/2024, 12:21 PMrequired feild for flags
type CommandFlag struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Shorthand string `yaml:"shorthand" json:"shorthand" mapstructure:"shorthand"`
Type string `yaml:"type" json:"type" mapstructure:"type"`
Description string `yaml:"description" json:"description" mapstructure:"description"`
Usage string `yaml:"usage" json:"usage" mapstructure:"usage"`
Required bool `yaml:"required" json:"required" mapstructure:"required"`
}Andriy Knysh (Cloud Posse)
10/31/2024, 12:21 PMtype CommandArgument struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Description string `yaml:"description" json:"description" mapstructure:"description"`
}Andriy Knysh (Cloud Posse)
10/31/2024, 12:22 PMdefault field to both arguments and flagsAndriy Knysh (Cloud Posse)
10/31/2024, 12:22 PMtype CommandFlag struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Shorthand string `yaml:"shorthand" json:"shorthand" mapstructure:"shorthand"`
Type string `yaml:"type" json:"type" mapstructure:"type"`
Description string `yaml:"description" json:"description" mapstructure:"description"`
Usage string `yaml:"usage" json:"usage" mapstructure:"usage"`
Required bool `yaml:"required" json:"required" mapstructure:"required"`
Default any `yaml:"default" json:"default" mapstructure:"default"`
}Andriy Knysh (Cloud Posse)
10/31/2024, 12:23 PMtype CommandArgument struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Description string `yaml:"description" json:"description" mapstructure:"description"`
Required bool `yaml:"required" json:"required" mapstructure:"required"`
Default any `yaml:"default" json:"default" mapstructure:"default"`
}Andriy Knysh (Cloud Posse)
10/31/2024, 12:23 PMAndriy Knysh (Cloud Posse)
10/31/2024, 12:24 PMdefault and required need to be sent to Cobra (as we do for the other fields of the commands), and Cobra will take care of missing arguments and flags and show the message and the usagePulak Kanti Bhowmick
10/31/2024, 6:29 PMPulak Kanti Bhowmick
11/05/2024, 7:30 AMPulak Kanti Bhowmick
11/05/2024, 7:32 AMAndriy Knysh (Cloud Posse)
11/05/2024, 1:49 PM