diff options
Diffstat (limited to 'commands/env.go')
-rw-r--r-- | commands/env.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/commands/env.go b/commands/env.go new file mode 100644 index 00000000..daba8420 --- /dev/null +++ b/commands/env.go @@ -0,0 +1,40 @@ +package commands + +import ( + "fmt" + "io" + "os" + + "github.com/MichaelMure/git-bug/repository" +) + +// Env is the environment of a command +type Env struct { + repo repository.ClockedRepo + out out + err out +} + +func newEnv() *Env { + return &Env{ + repo: nil, + out: out{Writer: os.Stdout}, + err: out{Writer: os.Stderr}, + } +} + +type out struct { + io.Writer +} + +func (o out) Printf(format string, a ...interface{}) { + _, _ = fmt.Fprintf(o, format, a...) +} + +func (o out) Print(a ...interface{}) { + _, _ = fmt.Fprint(o, a...) +} + +func (o out) Println(a ...interface{}) { + _, _ = fmt.Fprintln(o, a...) +} |