How to implement multiple options with cobra

1.6k Views Asked by At

I try this: projCmd.Flags().StringVarP(&flag, "type", "t", flag, "help")

But, how to implement multiple options with cobra like this: mycli new -t one -n two

1

There are 1 best solutions below

0
On BEST ANSWER

Add a second line with the next option you want to add. You are not limited to use one.

Eg:

projCmd.Flags().StringVarP(&flag, "type", "t", flag, "help")
projCmd.Flags().StringVarP(&flag2, "some", "s", flag2, "some description")