Skip to content

Commit

Permalink
Move shared package variables to cmd helper file
Browse files Browse the repository at this point in the history
The Root command is just a command (though admittedly a somewhat special one). The
cmd.go file is where we're putting shared stuff.
  • Loading branch information
Katrina Owen committed Dec 28, 2018
1 parent 42e56dc commit 812ae3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 17 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@ package cmd
import (
"fmt"

"io"

"github.com/exercism/cli/config"
"github.com/spf13/viper"
)

var (
// BinaryName is the name of the app.
// By default this is exercism, but people
// are free to name this however they want.
// The usage examples and help strings should reflect
// the actual name of the binary.
BinaryName string
// Out is used to write to information.
Out io.Writer
// Err is used to write errors.
Err io.Writer
// In is used to provide mocked test input (i.e. for prompts).
In io.Reader
)

const msgWelcomePleaseConfigure = `
Welcome to Exercism!
Expand Down
16 changes: 0 additions & 16 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
"io"
"os"
"runtime"

Expand All @@ -13,21 +12,6 @@ import (
"github.com/spf13/cobra"
)

var (
// BinaryName is the name of the app.
// By default this is exercism, but people
// are free to name this however they want.
// The usage examples and help strings should reflect
// the actual name of the binary.
BinaryName string
// Out is used to write to information.
Out io.Writer
// Err is used to write errors.
Err io.Writer
// In is used to provide mocked test input (i.e. for prompts).
In io.Reader
)

// RootCmd represents the base command when called without any subcommands.
var RootCmd = &cobra.Command{
Use: BinaryName,
Expand Down

0 comments on commit 812ae3b

Please sign in to comment.