Created
March 26, 2017 08:50
-
-
Save fd0/9cc52f7c0f5fc9d2cb84a1fcb43b11dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/spf13/cobra" | |
) | |
var cmdRoot = &cobra.Command{ | |
Run: func(*cobra.Command, []string) { | |
fmt.Printf("do something\n") | |
}, | |
} | |
func init() { | |
cmdRoot.Flags().SortFlags = false | |
cmdRoot.PersistentFlags().SortFlags = false | |
cmdRoot.LocalFlags().SortFlags = false | |
cmdRoot.Flags().StringP("epsilon", "e", "empty", "help for epsilon") | |
cmdRoot.Flags().StringP("zulu", "z", "empty", "help for zulu") | |
cmdRoot.Flags().StringP("alpha", "a", "empty", "help for alpha") | |
} | |
func main() { | |
fmt.Printf("err: %v\n", cmdRoot.Execute()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment