From a7b1281b02d11a484d8f3117b14ae9cdc73afac5 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Sat, 23 Apr 2022 23:05:22 +0700 Subject: [PATCH] feat: make interactive default true --- README.md | 2 +- internal/cli/action_generate.go | 6 ++---- internal/cli/app.go | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9eb4ad3..b5a19b5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Tool to generate `CHANGELOG.md`, `CHANGELOG.rst` from [Conventional Commits](htt ## Roadmap - [ ] Support `CHANGELOG.txt` -- [ ] Interactive mode +- [x] Interactive mode - [ ] Unit test ## Install diff --git a/internal/cli/action_generate.go b/internal/cli/action_generate.go index e8ab02e..1d0e7eb 100644 --- a/internal/cli/action_generate.go +++ b/internal/cli/action_generate.go @@ -36,8 +36,6 @@ func (a *action) RunGenerate(c *cli.Context) error { fmt.Printf("Input to (%s):\n", usageTo) a.flags.to = ioe.ReadInputEmpty() - - // TODO: support more flags } commits, err := a.getCommits() @@ -149,7 +147,7 @@ func (a *action) generateMarkdownChangelog(output, version string, commits []con } // Actually writing to changelog file - if err := os.WriteFile(output, []byte(changelogText), 0644); err != nil { + if err := os.WriteFile(output, []byte(changelogText), 0o644); err != nil { return fmt.Errorf("failed to write file %s: %w", output, err) } @@ -181,7 +179,7 @@ func (a *action) generateRSTChangelog(output, version string, commits []conventi } // Actually writing to changelog file - if err := os.WriteFile(output, []byte(changelogText), 0644); err != nil { + if err := os.WriteFile(output, []byte(changelogText), 0o644); err != nil { return fmt.Errorf("failed to write file %s: %w", output, err) } diff --git a/internal/cli/app.go b/internal/cli/app.go index a334bee..41f64fc 100644 --- a/internal/cli/app.go +++ b/internal/cli/app.go @@ -36,7 +36,7 @@ const ( usageFilename = "output `FILENAME`" usageFiletype = "output `FILETYPE`" usageDryRun = "demo run without actually changing anything" - usageInteractive = "interactive mode" + usageInteractive = "interactive mode, default is true" ) var ( @@ -110,6 +110,7 @@ func NewApp() *App { Name: flagInteractive, Usage: usageInteractive, Aliases: aliasInteractive, + Value: true, }, }, Action: a.RunGenerate,