(env *execenv.Env)
| 15 | } |
| 16 | |
| 17 | func newVersionCommand(env *execenv.Env) *cobra.Command { |
| 18 | options := versionOptions{} |
| 19 | |
| 20 | cmd := &cobra.Command{ |
| 21 | Use: "version", |
| 22 | Short: "Show git-bug version information", |
| 23 | Run: func(cmd *cobra.Command, args []string) { |
| 24 | runVersion(env, options, cmd.Root()) |
| 25 | }, |
| 26 | } |
| 27 | |
| 28 | flags := cmd.Flags() |
| 29 | flags.SortFlags = false |
| 30 | |
| 31 | flags.BoolVarP(&options.number, "number", "n", false, |
| 32 | "Only show the version number", |
| 33 | ) |
| 34 | flags.BoolVarP(&options.commit, "commit", "c", false, |
| 35 | "Only show the commit hash", |
| 36 | ) |
| 37 | flags.BoolVarP(&options.all, "all", "a", false, |
| 38 | "Show all version information", |
| 39 | ) |
| 40 | |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runVersion(env *execenv.Env, opts versionOptions, root *cobra.Command) { |
| 45 | if opts.all { |
no test coverage detected