From 0fe0ffbafab8b28cdb36c8b09020a74e84b657d7 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sun, 19 Dec 2021 16:15:45 +0100 Subject: [PATCH] refactor: move flags to internal/common --- cli/internal/common.go | 70 +++++++++++++++++++++++++++++++++++++++++ cli/internal/recipe.go | 71 ------------------------------------------ 2 files changed, 70 insertions(+), 71 deletions(-) diff --git a/cli/internal/common.go b/cli/internal/common.go index b11ff0fd..4d7fc29f 100644 --- a/cli/internal/common.go +++ b/cli/internal/common.go @@ -295,6 +295,76 @@ var RCFlag = &cli.BoolFlag{ Usage: "Insatll the latest release candidate", } +var Major bool +var MajorFlag = &cli.BoolFlag{ + Name: "major", + Usage: "Increase the major part of the version", + Value: false, + Aliases: []string{"ma", "x"}, + Destination: &Major, +} + +var Minor bool +var MinorFlag = &cli.BoolFlag{ + Name: "minor", + Usage: "Increase the minor part of the version", + Value: false, + Aliases: []string{"mi", "y"}, + Destination: &Minor, +} + +var Patch bool +var PatchFlag = &cli.BoolFlag{ + Name: "patch", + Usage: "Increase the patch part of the version", + Value: false, + Aliases: []string{"p", "z"}, + Destination: &Patch, +} + +var Dry bool +var DryFlag = &cli.BoolFlag{ + Name: "dry-run", + Usage: "No changes are made, only reports changes that would be made", + Value: false, + Aliases: []string{"d"}, + Destination: &Dry, +} + +var Push bool +var PushFlag = &cli.BoolFlag{ + Name: "push", + Usage: "Git push changes", + Value: false, + Aliases: []string{"P"}, + Destination: &Push, +} + +var CommitMessage string +var CommitMessageFlag = &cli.StringFlag{ + Name: "commit-message", + Usage: "Commit message (implies --commit)", + Aliases: []string{"cm"}, + Destination: &CommitMessage, +} + +var Commit bool +var CommitFlag = &cli.BoolFlag{ + Name: "commit", + Usage: "Commits compose.**yml file changes to recipe repository", + Value: false, + Aliases: []string{"c"}, + Destination: &Commit, +} + +var TagMessage string +var TagMessageFlag = &cli.StringFlag{ + Name: "tag-comment", + Usage: "Description for release tag", + Aliases: []string{"t", "tm"}, + Destination: &TagMessage, +} + // SSHFailMsg is a hopefully helpful SSH failure message var SSHFailMsg = ` Woops, Abra is unable to connect to connect to %s. diff --git a/cli/internal/recipe.go b/cli/internal/recipe.go index f3c87074..1ce203fb 100644 --- a/cli/internal/recipe.go +++ b/cli/internal/recipe.go @@ -7,79 +7,8 @@ import ( "coopcloud.tech/abra/pkg/recipe" "github.com/AlecAivazis/survey/v2" "github.com/sirupsen/logrus" - "github.com/urfave/cli/v2" ) -var Major bool -var MajorFlag = &cli.BoolFlag{ - Name: "major", - Usage: "Increase the major part of the version", - Value: false, - Aliases: []string{"ma", "x"}, - Destination: &Major, -} - -var Minor bool -var MinorFlag = &cli.BoolFlag{ - Name: "minor", - Usage: "Increase the minor part of the version", - Value: false, - Aliases: []string{"mi", "y"}, - Destination: &Minor, -} - -var Patch bool -var PatchFlag = &cli.BoolFlag{ - Name: "patch", - Usage: "Increase the patch part of the version", - Value: false, - Aliases: []string{"p", "z"}, - Destination: &Patch, -} - -var Dry bool -var DryFlag = &cli.BoolFlag{ - Name: "dry-run", - Usage: "No changes are made, only reports changes that would be made", - Value: false, - Aliases: []string{"d"}, - Destination: &Dry, -} - -var Push bool -var PushFlag = &cli.BoolFlag{ - Name: "push", - Usage: "Git push changes", - Value: false, - Aliases: []string{"P"}, - Destination: &Push, -} - -var CommitMessage string -var CommitMessageFlag = &cli.StringFlag{ - Name: "commit-message", - Usage: "Commit message (implies --commit)", - Aliases: []string{"cm"}, - Destination: &CommitMessage, -} - -var Commit bool -var CommitFlag = &cli.BoolFlag{ - Name: "commit", - Usage: "Commits compose.**yml file changes to recipe repository", - Value: false, - Aliases: []string{"c"}, - Destination: &Commit, -} - -var TagMessage string -var TagMessageFlag = &cli.StringFlag{ - Name: "tag-comment", - Usage: "Description for release tag", - Aliases: []string{"t", "tm"}, - Destination: &TagMessage, -} - // PromptBumpType prompts for version bump type func PromptBumpType(tagString string) error { if (!Major && !Minor && !Patch) && tagString == "" {