1package commands
2
3import (
4 "fmt"
5 "io"
6 "os"
7
8 "github.com/MichaelMure/git-bug/repository"
9)
10
11// Env is the environment of a command
12type Env struct {
13 repo repository.ClockedRepo
14 out out
15 err out
16}
17
18func newEnv() *Env {
19 return &Env{
20 repo: nil,
21 out: out{Writer: os.Stdout},
22 err: out{Writer: os.Stderr},
23 }
24}
25
26type out struct {
27 io.Writer
28}
29
30func (o out) Printf(format string, a ...interface{}) {
31 _, _ = fmt.Fprintf(o, format, a...)
32}
33
34func (o out) Print(a ...interface{}) {
35 _, _ = fmt.Fprint(o, a...)
36}
37
38func (o out) Println(a ...interface{}) {
39 _, _ = fmt.Fprintln(o, a...)
40}