From acc9a6f3a6df2961c3ae44352216d915cb9b5315 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 10 Sep 2022 11:09:19 +0200 Subject: commands: reorg into different packages --- commands/version.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'commands/version.go') 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) } -- cgit