aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.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/commands.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/commands.go')
-rw-r--r--commands/commands.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/commands/commands.go b/commands/commands.go
index 49c960ab..7d2fc37d 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -4,6 +4,8 @@ import (
"sort"
"github.com/spf13/cobra"
+
+ "github.com/MichaelMure/git-bug/commands/execenv"
)
type commandOptions struct {
@@ -11,7 +13,7 @@ type commandOptions struct {
}
func newCommandsCommand() *cobra.Command {
- env := newEnv()
+ env := execenv.NewEnv()
options := commandOptions{}
cmd := &cobra.Command{
@@ -32,7 +34,7 @@ func newCommandsCommand() *cobra.Command {
return cmd
}
-func runCommands(env *Env, opts commandOptions) error {
+func runCommands(env *execenv.Env, opts commandOptions) error {
first := true
var allCmds []*cobra.Command
@@ -49,24 +51,24 @@ func runCommands(env *Env, opts commandOptions) error {
for _, cmd := range allCmds {
if !first {
- env.out.Println()
+ env.Out.Println()
}
first = false
if opts.desc {
- env.out.Printf("# %s\n", cmd.Short)
+ env.Out.Printf("# %s\n", cmd.Short)
}
- env.out.Print(cmd.UseLine())
+ env.Out.Print(cmd.UseLine())
if opts.desc {
- env.out.Println()
+ env.Out.Println()
}
}
if !opts.desc {
- env.out.Println()
+ env.Out.Println()
}
return nil