0

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

vahdet
  • 6,357
  • 9
  • 51
  • 106
null
  • 115
  • 1
  • 9

1 Answers1

0

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")
Sascha
  • 10,231
  • 4
  • 41
  • 65