aboutsummaryrefslogtreecommitdiffstats
path: root/commands/version.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-11-22 14:53:15 +0100
committerGitHub <noreply@github.com>2022-11-22 14:53:15 +0100
commit70bd7377b6362127794f3a6198dd2c63863025fc (patch)
treee159372673104ade1f15ddc1a84aa9da93e93552 /commands/version.go
parenta3fa445a9c76631c4cd16f93e1c1c68a954adef7 (diff)
parentacc9a6f3a6df2961c3ae44352216d915cb9b5315 (diff)
downloadgit-bug-70bd7377b6362127794f3a6198dd2c63863025fc.tar.gz
Merge pull request #870 from MichaelMure/cli-reorg
commands: reorg into different packages
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)
}