Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Windows colors #9

Merged
merged 2 commits into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/git-chglog/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"path/filepath"

"github.com/fatih/color"
"github.com/mattn/go-colorable"
gitcmd "github.com/tsuyoshiwada/go-gitcmd"
)

Expand All @@ -30,7 +31,7 @@ func NewInitializer(
return &Initializer{
ctx: ctx,
fs: fs,
logger: NewLogger(ctx.Stdout, ctx.Stderr, false, false),
logger: NewLogger(colorable.NewColorableStdout(), colorable.NewColorableStderr(), false, false),
Copy link
Member

@wadackel wadackel Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to use InitContext.Stdout (and .Stderr) in NewInitializer, but do you have any special reasons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Reverted this part.

questioner: questioner,
configBuilder: configBuilder,
templateBuilder: templateBuilder,
Expand Down
9 changes: 5 additions & 4 deletions cmd/git-chglog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/fatih/color"
"github.com/mattn/go-colorable"
gitcmd "github.com/tsuyoshiwada/go-gitcmd"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -120,8 +121,8 @@ func main() {
initializer := NewInitializer(
&InitContext{
WorkingDir: wd,
Stdout: os.Stdout,
Stderr: os.Stderr,
Stdout: colorable.NewColorableStdout(),
Stderr: colorable.NewColorableStderr(),
},
fs,
NewQuestioner(
Expand All @@ -141,8 +142,8 @@ func main() {
chglogCLI := NewCLI(
&CLIContext{
WorkingDir: wd,
Stdout: os.Stdout,
Stderr: os.Stderr,
Stdout: colorable.NewColorableStdout(),
Stderr: colorable.NewColorableStderr(),
ConfigPath: c.String("config"),
OutputPath: c.String("output"),
Silent: c.Bool("silent"),
Expand Down