From 4dbdccfa43fd6cf5eb2b540335979b8ba60db684 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Thu, 29 Jun 2023 17:52:46 +0700 Subject: [PATCH] feat: hide interactive from when ask Why? Because I don't use that feat --- internal/cli/action.go | 30 ++++++++++++++++-------------- internal/cli/action_generate.go | 5 +++++ internal/cli/app.go | 7 +++++++ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/internal/cli/action.go b/internal/cli/action.go index 7b9380f..43664f9 100644 --- a/internal/cli/action.go +++ b/internal/cli/action.go @@ -19,20 +19,21 @@ const ( type action struct { flags struct { - scopes map[string]struct{} - output string - from string - to string - version string - repository string - filename string - filetype string - verbose bool - dryRun bool - interactive bool - autoGitCommit bool - autoGitTag bool - autoGitPush bool + scopes map[string]struct{} + output string + from string + to string + version string + repository string + filename string + filetype string + verbose bool + dryRun bool + interactive bool + interactiveFrom bool + autoGitCommit bool + autoGitTag bool + autoGitPush bool } } @@ -77,6 +78,7 @@ func (a *action) getFlags(c *cli.Context) { a.flags.dryRun = c.Bool(flagDryRunName) a.flags.interactive = c.Bool(flagInteractiveName) + a.flags.interactiveFrom = c.Bool(flagInteractiveFromName) a.flags.autoGitCommit = c.Bool(flagAutoGitCommitName) a.flags.autoGitTag = c.Bool(flagAutoGitTagName) a.flags.autoGitPush = c.Bool(flagAutoGitPushName) diff --git a/internal/cli/action_generate.go b/internal/cli/action_generate.go index 0cbc36d..324f0f1 100644 --- a/internal/cli/action_generate.go +++ b/internal/cli/action_generate.go @@ -42,6 +42,11 @@ func (a *action) RunGenerate(c *cli.Context) error { fmt.Printf("Input version (%s):\n", flagVersionUsage) a.flags.version = ioe.ReadInput() + if a.flags.interactiveFrom { + fmt.Printf("Input from (%s):\n", flagFromUsage) + a.flags.from = ioe.ReadInputEmpty() + } + fmt.Printf("Input to (%s):\n", flagToUsage) a.flags.to = ioe.ReadInputEmpty() } diff --git a/internal/cli/app.go b/internal/cli/app.go index 711afa2..e6ba249 100644 --- a/internal/cli/app.go +++ b/internal/cli/app.go @@ -48,6 +48,9 @@ const ( flagInteractiveName = "interactive" flagInteractiveUsage = "interactive mode" + flagInteractiveFromName = "interactive-from" + flagInteractiveFromUsage = "enable ask from in interactive mode" + flagAutoGitCommitName = "auto-commit" flagAutoGitCommitUsage = "enable auto git commit after generating changelog" @@ -126,6 +129,10 @@ func NewApp() *App { Usage: flagInteractiveUsage, Aliases: flagInteractiveAliases, }, + &cli.BoolFlag{ + Name: flagInteractiveFromName, + Usage: flagInteractiveFromUsage, + }, &cli.BoolFlag{ Name: flagAutoGitCommitName, Usage: flagAutoGitCommitUsage,