From 195320517d7879dabf3cf46f0692679c3d613338 Mon Sep 17 00:00:00 2001 From: NickDeChip <111223952+NickDeChip@users.noreply.github.com> Date: Mon, 31 Oct 2022 15:15:40 +1100 Subject: [PATCH] feat: octopus logo on root help page --- pkg/cmd/config/get/get.go | 2 +- pkg/cmd/config/set/set.go | 2 +- pkg/cmd/root/help.go | 5 +++++ pkg/config/config.go | 2 +- pkg/constants/constants.go | 23 +++++++++++++++++++++-- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/config/get/get.go b/pkg/cmd/config/get/get.go index da848d1a..20ea6bb2 100644 --- a/pkg/cmd/config/get/get.go +++ b/pkg/cmd/config/get/get.go @@ -62,7 +62,7 @@ func promptMissing(ask question.Asker) (string, error) { constants.ConfigNoPrompt, constants.ConfigHost, constants.ConfigOutputFormat, - // constants.ConfigShowOctopus, + constants.ConfigShowOctopus, constants.ConfigEditor, // constants.ConfigProxyUrl, } diff --git a/pkg/cmd/config/set/set.go b/pkg/cmd/config/set/set.go index 0ba44107..feb3f406 100644 --- a/pkg/cmd/config/set/set.go +++ b/pkg/cmd/config/set/set.go @@ -88,7 +88,7 @@ func promptMissing(ask question.Asker, key string) (string, string, error) { constants.ConfigNoPrompt, constants.ConfigHost, constants.ConfigOutputFormat, - // constants.ConfigShowOctopus, + constants.ConfigShowOctopus, constants.ConfigEditor, // constants.ConfigProxyUrl, } diff --git a/pkg/cmd/root/help.go b/pkg/cmd/root/help.go index 338c54d9..06fef54f 100644 --- a/pkg/cmd/root/help.go +++ b/pkg/cmd/root/help.go @@ -6,9 +6,11 @@ import ( "regexp" "strings" + "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/constants/annotations" "github.com/OctopusDeploy/cli/pkg/output" "github.com/spf13/cobra" + "github.com/spf13/viper" ) func isRootCmd(cmd *cobra.Command) bool { @@ -63,6 +65,9 @@ func rootHelpFunc(cmd *cobra.Command, _ []string) { if longText != "" { helpEntries = append(helpEntries, helpEntry{"", longText}) } + if isRootCmd(cmd) && viper.GetBool(constants.ConfigShowOctopus) { + helpEntries = append(helpEntries, helpEntry{"", output.Bluef("%s", constants.OctopusLogo)}) + } helpEntries = append(helpEntries, helpEntry{"USAGE", cmd.UseLine()}) if len(coreCmds) > 0 { helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", strings.Join(coreCmds, "\n")}) diff --git a/pkg/config/config.go b/pkg/config/config.go index 8887ca39..38ecf5ae 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -27,7 +27,7 @@ func setDefaults(v *viper.Viper) { v.SetDefault(constants.ConfigSpace, "") v.SetDefault(constants.ConfigNoPrompt, false) // v.SetDefault(constants.ConfigProxyUrl, "") - // v.SetDefault(constants.ConfigShowOctopus, true) + v.SetDefault(constants.ConfigShowOctopus, true) v.SetDefault(constants.ConfigOutputFormat, "table") if runtime.GOOS == "windows" { diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 772103ab..7a8391ea 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -33,8 +33,8 @@ const ( ConfigSpace = "Space" ConfigNoPrompt = "NoPrompt" // ConfigProxyUrl = "ProxyUrl" - ConfigEditor = "Editor" - // ConfigShowOctopus = "ShowOctopus" + ConfigEditor = "Editor" + ConfigShowOctopus = "ShowOctopus" ConfigOutputFormat = "OutputFormat" ) @@ -51,10 +51,29 @@ const ( NoDescription = "No description provided" ) +const OctopusLogo = ` &#BGGGGGGB#& + &GP%%%%%%%%%%%%%G& + &G%%%%%%%%%%%%%%%%%%P& + &%%%%%%%%%%%%%%%%%%%%%%# + %%%%%%%%%%%%%%%%%%%%%%%% + #%%%%%%%%%%%%%%%%%%%%%%%%& + #%%%%%%%%%%%%%%%%%%%%%%%%& + P%%%%%%%%%%%%%%%%%%%%%%# + &%%%%%%%%%%%%%%%%%%%%%G + B%%%%%%%%%%%%%%%%%%%%# + P%%%%%%%%%%%%%%%%%%%%P + &P%%%%%%%%%%%%%%%%%%%%%%P# + #G%%%%P%%%%%%GP%%%%%%PP%%%%%PG& +&G%%%PB&#P%%%%G G%%%%P &P%%P#&& + && G%%%%# &%%%%G #P%%# + &%%%G& G%%%B && + &# BPB` + const ( PromptCreateNew = "" ) + // IsProgrammaticOutputFormat tells you if it is acceptable for your command to // print miscellaneous output to stdout, such as progress messages. // If your command is capable of printing such things, you should check the output format