Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试试这个: projCmd.Flags().StringVarP(&flag, "type", "t", flag, "help")
projCmd.Flags().StringVarP(&flag, "type", "t", flag, "help")
但是,如何使用 cobra 实现多个选项,如下所示: mycli new -t one -n two
mycli new -t one -n two
添加第二行,其中包含您要添加的下一个选项。您不限于使用一个。
例如:
projCmd.Flags().StringVarP(&flag, "type", "t", flag, "help") projCmd.Flags().StringVarP(&flag2, "some", "s", flag2, "some description")