aboutsummaryrefslogtreecommitdiffstats
path: root/commands/version.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/version.go')
-rw-r--r--commands/version.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/commands/version.go b/commands/version.go
index 71baba40..0e54bb92 100644
--- a/commands/version.go
+++ b/commands/version.go
@@ -4,6 +4,8 @@ import (
"runtime"
"github.com/spf13/cobra"
+
+ "github.com/MichaelMure/git-bug/commands/execenv"
)
type versionOptions struct {
@@ -13,12 +15,12 @@ type versionOptions struct {
}
func newVersionCommand() *cobra.Command {
- env := newEnv()
+ env := execenv.NewEnv()
options := versionOptions{}
cmd := &cobra.Command{
Use: "version",
- Short: "Show git-bug version information.",
+ Short: "Show git-bug version information",
Run: func(cmd *cobra.Command, args []string) {
runVersion(env, options, cmd.Root())
},
@@ -40,23 +42,23 @@ func newVersionCommand() *cobra.Command {
return cmd
}
-func runVersion(env *Env, opts versionOptions, root *cobra.Command) {
+func runVersion(env *execenv.Env, opts versionOptions, root *cobra.Command) {
if opts.all {
- env.out.Printf("%s version: %s\n", rootCommandName, root.Version)
- env.out.Printf("System version: %s/%s\n", runtime.GOARCH, runtime.GOOS)
- env.out.Printf("Golang version: %s\n", runtime.Version())
+ env.Out.Printf("%s version: %s\n", execenv.RootCommandName, root.Version)
+ env.Out.Printf("System version: %s/%s\n", runtime.GOARCH, runtime.GOOS)
+ env.Out.Printf("Golang version: %s\n", runtime.Version())
return
}
if opts.number {
- env.out.Println(root.Version)
+ env.Out.Println(root.Version)
return
}
if opts.commit {
- env.out.Println(GitCommit)
+ env.Out.Println(GitCommit)
return
}
- env.out.Printf("%s version: %s\n", rootCommandName, root.Version)
+ env.Out.Printf("%s version: %s\n", execenv.RootCommandName, root.Version)
}