aboutsummaryrefslogtreecommitdiffstats
path: root/commands/env.go
blob: daba84208ec3abf9ffce3dac2b30381bf34d6262 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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...)
}