From eabde4e6b49c78cf4378fea23fc83341561a4a23 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Fri, 7 Jan 2022 11:43:50 +0300 Subject: [PATCH] Add custom app name color --- .github/workflows/ci.yml | 3 +++ cli/cli.go | 26 ++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d3143c4..92ee63ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,6 +157,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + if: ${{ env.DOCKERHUB_USERNAME != '' }} with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/cli/cli.go b/cli/cli.go index 17a121c5..35f783a6 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -37,7 +37,7 @@ import ( // Application info const ( APP = "bibop" - VER = "5.1.0" + VER = "5.1.1" DESC = "Utility for testing command-line tools" ) @@ -84,6 +84,9 @@ var optMap = options.Map{ OPT_GENERATE_MAN: {Type: options.BOOL}, } +var colorTagApp string +var colorTagVer string + // ////////////////////////////////////////////////////////////////////////////////// // func Init() { @@ -106,7 +109,6 @@ func Init() { } configureUI() - configureSubsystems() if options.GetB(OPT_VER) { showAbout() @@ -118,6 +120,8 @@ func Init() { os.Exit(0) } + configureSubsystems() + validateOptions() process(args[0]) } @@ -134,11 +138,16 @@ func configureUI() { fmtutil.SeparatorSymbol = "–" - if fmtc.Is256ColorsSupported() { - fmtutil.SeparatorTitleColorTag = "{#85}" - } else { - fmtutil.SeparatorTitleColorTag = "{c*}" + switch { + case fmtc.IsTrueColorSupported(): + colorTagApp, colorTagVer = "{#66CC99}", "{#66CC99}" + case fmtc.Is256ColorsSupported(): + colorTagApp, colorTagVer = "{#85}", "{#85}" + default: + colorTagApp, colorTagVer = "{c}", "{c}" } + + fmtutil.SeparatorTitleColorTag = colorTagApp } // configureSubsystems configures bibop subsystems @@ -380,6 +389,8 @@ func genMan() int { func genUsage() *usage.Info { info := usage.NewInfo("", "recipe") + info.AppNameColorTag = "{*}" + colorTagApp + info.AddOption(OPT_DRY_RUN, "Parse and validate recipe") info.AddOption(OPT_LIST_PACKAGES, "List required packages") info.AddOption(OPT_FORMAT, "Output format {s-}(tap|json|xml){!}", "format") @@ -428,6 +439,9 @@ func genAbout() *usage.About { License: "Apache License, Version 2.0 ", BugTracker: "https://github.com/essentialkaos/bibop/issues", UpdateChecker: usage.UpdateChecker{"essentialkaos/bibop", update.GitHubChecker}, + + AppNameColorTag: "{*}" + colorTagApp, + VersionColorTag: colorTagVer, } return about