diff --git a/CHANGELOG.md b/CHANGELOG.md index a2fc25d..a488c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # RELEASE NOTES +## 1.5.5 (June 21, 2023) + +### Enhancements + +* Improve the way spinner output is displayed. NOTE: the spinner will not print output if not attached to a tty. +* Update the versions and descriptions of the dependencies in the `packages-list.json` + ## 1.5.4 (March 16, 2023) ### Enhancements diff --git a/assets/package-list.json b/assets/package-list.json deleted file mode 100644 index db267a3..0000000 --- a/assets/package-list.json +++ /dev/null @@ -1,420 +0,0 @@ -{ - "version": 1.0, - "packages": [ - - - - - - - - { - "title": "Adaptive Acceleration", - "name": "adaptive-acceleration", - "version": "0.1", - "url": "https://github.com/akamai/cli-adaptive-acceleration", - "issues": "https://github.com/akamai/cli-adaptive-acceleration/issues", - "commands": [{"name":"adaptive-acceleration","aliases":["a2"],"version":"0.1","description":"Reset A2 Push and Preconnect policy"}], - "requirements": {"python":"3.0.0"} - }, - - - - - { - "title": "API Gateway", - "name": "akamai/api-gateway", - "version": "0.1.0", - "url": "https://github.com/akamai/cli-api-gateway", - "issues": "https://github.com/akamai/cli-api-gateway/issues", - "commands": [ - { - "name": "api-gateway", - "version": "0.1.0", - "description": "Manage API definitions and endpoints", - "auto-complete": true, - "bin": "https://github.com/akamai/cli-api-gateway/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}" - }, - { - "name": "api-keys", - "version": "0.1.0", - "description": "Manage API keys", - "auto-complete": true, - "bin": "https://github.com/akamai/cli-api-gateway/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}" - }, - { - "name": "api-security", - "version": "0.1.0", - "description": "Manage API protections", - "auto-complete": true, - "bin": "https://github.com/akamai/cli-api-gateway/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}" - } - ], - "requirements": { - "go": "1.10.0" - } - }, - - - - - - - - { - "title": "Application Security", - "name": "appsec", - "version": "2.3.0", - "url": "https://github.com/akamai/cli-appsec", - "issues": "https://github.com/akamai/cli-appsec/issues", - "commands": [{"name":"appsec","version":"2.3.0","description":"Manage security configurations for Kona Site Defender and Client Reputation."}], - "requirements": {"node":"7.0.0"} - }, - - - - - - - - { - "title": "Authentication", - "name": "auth", - "version": "0.0.3", - "url": "https://github.com/akamai/cli-auth", - "issues": "https://github.com/akamai/cli-auth/issues", - "commands": [{"name":"auth","version":"0.0.3","description":"Interface for Akamai Edgegrid Authentication","bin":"https://github.com/akamai/cli-auth/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}-{{.Arch}}{{.BinSuffix}}"}], - "requirements": {"node":"7.0.0"} - }, - - - - { - "title": "Client Access Control (CAC)", - "name": "cac", - "version": "v1.0.8", - "url": "https://github.com/akamai/cli-cac", - "issues": "https://github.com/akamai/cli-cac/issues", - "commands": [{"name":"cac","aliases":["cac"],"version":"v1.0.8","description":"Interface for Client Access Control (CAC) in the Akamai CLI tool"}], - "requirements": {"python":"3.0.0"} - }, - - - - - { - "title": "Certificate Provisioning Service (CPS)", - "name": "cps", - "version": "v1.0.9", - "url": "https://github.com/akamai/cli-cps", - "issues": "https://github.com/akamai/cli-cps/issues", - "commands": [ - { - "name": "cps", - "aliases": [ - "certs" - ], - "version": "1.0.9", - "description": "Access Certificate Provisioning System (CPS) Information" - } - ], - "requirements": { - "python": "3.0.0" - } - }, - - - - { - "title": "Cloudlets", - "name": "cloudlets", - "version": "v1.0.0", - "url": "https://github.com/akamai/cli-cloudlets", - "issues": "https://github.com/akamai/cli-cloudlets/issues", - "commands": [{"name":"cloudlets","aliases":["cloudlets"],"version":"1.0.0","description":"Manage cloudlet configurations"}], - "requirements": {"python":"3.0.0"} - }, - - - - - { - "title": "Diagnostics", - "name": "diagnostics", - "version": "v1.1.0", - "url": "https://github.com/akamai/cli-diagnostics", - "issues": "https://github.com/akamai/cli-diagnostics/issues", - "commands": [{"name":"diagnostics","aliases":["diag", "edge-diagnostics"],"version":"v1.1.0","description":"Edge Diagnostics enables you to identify, analyze, and troubleshoot common content delivery network issues that your users may encounter.","bin": "https://github.com/akamai/cli-diagnostics/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}"}], - "requirements": {"go":"1.17.1"} - }, - - - - { - "title": "EdgeWorkers", - "name": "edgeworkers", - "version": "1.3.1", - "url": "https://github.com/akamai/cli-edgeworkers", - "issues": "https://github.com/akamai/cli-edgeworkers/issues", - "commands": [ - {"name":"edgeworkers","aliases":["ew", "edgeworkers"],"version":"1.3.1","description":"Akamai CLI for EdgeWorkers, allows you to interact with Akamai EdgeWorkers code bundles"}, - {"name":"edgekv","aliases":["ekw", "edgekv"],"version":"1.3.1","description":"Akamai CLI for EdgeWorkers, allows you to interact with Akamai EdgeKV database"} - ], - "requirements": {"node":"7.0.0"} - }, - - { - "title": "Akamai Sandbox", - "name": "sandbox", - "version": "v1.5.0", - "url": "https://github.com/akamai/cli-sandbox", - "issues": "https://github.com/akamai/cli-sandbox/issues", - "commands": [{"name":"sandbox","aliases":[""],"version":"1.5.0","description":"The Sandbox command line interface (CLI) expedites the process of creating an isolated development environment for testing changes to your website or property"}], - "requirements": {"node":"8.4.0"} - }, - - - - - - { - "title": "Edge DNS", - "name": "dns", - "version": "0.4.0", - "url": "https://github.com/akamai/cli-dns", - "issues": "https://github.com/akamai/cli-dns/issues", - "commands": [{"name":"dns","version":"0.4.0","description":"Manage DNS zones with Edge DNS","bin":"https://github.com/akamai/cli-dns/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.12.0"} - }, - - - - - - { - "title": "Enterprise Application Access", - "name": "eaa", - "version": "0.4.2", - "url": "https://github.com/akamai/cli-eaa", - "issues": "https://github.com/akamai/cli-eaa/issues", - "commands": [ - { - "name": "eaa", - "version": "0.4.2", - "description": "Akamai CLI for Enterprise Application Access (EAA)" - } - ], - "requirements": { - "python": "3.6.0" - } - }, - - - - - - { - "title": "Firewall and Site Shield", - "name": "firewall", - "version": "v0.2.1", - "url": "https://github.com/akamai/cli-firewall", - "issues": "https://github.com/akamai/cli-firewall/issues", - "commands": [ - {"name":"firewall","aliases":["fw"],"version":"0.2.1","description":"Access Akamai Firewall Rules Services, Subscriptions, and CIDRs"}, - {"name":"site-shield","aliases":["ss"],"version":"0.2.1","description":"Access details of Site-Shield Maps, CIDRs and acknowledgement"} - ], - "requirements": {"python":"3.0.0"} - }, - - - - - - - - { - "title": "Global Traffic Management", - "name": "gtm", - "version": "0.4.0", - "url": "https://github.com/akamai/cli-gtm", - "issues": "https://github.com/akamai/cli-gtm/issues", - "commands": [{"name":"gtm","version":"0.4.0","description":"Limited Management of GTM domains","bin":"https://github.com/akamai/cli-gtm/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.8.0"} - }, - - - - - - - - { - "title": "Image Manager", - "name": "image-manager", - "version": "0.1.9", - "url": "https://github.com/akamai/cli-image-manager", - "issues": "https://github.com/akamai/cli-image-manager/issues", - "commands": [ - {"name":"image-manager","aliases":["im"],"version":"0.1.9","description":"An Akamai CLI package for Image Manager"}, - {"name":"video-manager","aliases":["im"],"version":"0.1.9","description":"An Akamai CLI package for Video Manager"} - ], - "requirements": {"python":"3.0.0"} - }, - - - - - - { - "title": "Jsonnet", - "name": "jsonnet", - "version": "0.4.3", - "url": "https://github.com/akamai/cli-jsonnet", - "issues": "https://github.com/akamai/cli-jsonnet/issues", - "commands": [ - { - "name": "jsonnet", - "aliases": [ - "jsonnet" - ], - "version": "0.4.3", - "description": "Utilities for managing Akamai as jsonnet" - } - ], - "requirements": { - "python": "3.0.0" - } - }, - - - - - - - - { - "title": "NetStorage", - "name": "netstorage", - "version": "1.0.1", - "url": "https://github.com/akamai/cli-netstorage", - "issues": "https://github.com/akamai/cli-netstorage/issues", - "commands": [{"name":"netstorage","version":"1.0.1","description":"Interface for Akamai NetStorage","bin":"https://github.com/akamai/cli-netstorage/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}-{{.Arch}}{{.BinSuffix}}"}], - "requirements": {"node":"7.0.0"} - }, - - - - - - - - { - "title": "Onboard", - "name": "onboard", - "version": "1.0.3", - "url": "https://github.com/akamai/cli-onboard", - "issues": "https://github.com/akamai/cli-onboard/issues", - "commands": [{"name":"onboard","aliases":["onboard"],"version":"1.0.3","description":"Onboard Akamai delivery and WAF configuration"}], - "requirements": {"python":"3.0.0"} - }, - - - - - - - - { - "title": "Property Manager 1.0", - "name": "property", - "version": "1.1.6", - "url": "https://github.com/akamai/cli-property", - "issues": "https://github.com/akamai/cli-property/issues", - "commands": [{"name":"property","version":"1.1.6","description":"Manage configurations for Akamai properties","bin":"https://github.com/akamai/cli-property/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}-{{.Arch}}{{.BinSuffix}}"}], - "requirements": {"node":"7.0.0"} - }, - - - - - - - - { - "title": "Property Manager", - "name": "property-manager", - "version": "0.7.8-RELEASE", - "url": "https://github.com/akamai/cli-property-manager", - "issues": "https://github.com/akamai/cli-property-manager/issues", - "commands": [ - {"name":"snippets","aliases":["pm","property-manager"],"version":"0.7.7-RELEASE","description":"Property Manager CLI for DevOps"}, - {"name":"pipeline","aliases":["pl","pipeline","pd","proddeploy"],"version":"0.7.7-RELEASE","description":"Akamai Pipeline for DevOps"} - ], - "requirements": {"node":"8.9.1"} - }, - - - - - - - - { - "title": "Purge", - "name": "purge", - "version": "1.0.1", - "url": "https://github.com/akamai/cli-purge", - "issues": "https://github.com/akamai/cli-purge/issues", - "commands": [{"name":"purge","version":"1.0.1","description":"Purge content from the Edge","bin":"https://github.com/akamai/cli-purge/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.8.0"} - }, - - - - - - - - { - "title": "Terraform Client Configuration", - "name": "terraform", - "version": "0.3.0", - "url": "https://github.com/akamai/cli-terraform", - "issues": "https://github.com/akamai/cli-terraform/issues", - "commands": [{"name":"terraform","version":"0.3.0","description":"Create TF Configurations for Existing GTM domains, EdgeDNS zones and Property Manager properties","bin":"https://github.com/akamai/cli-terraform/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.12.0"} - }, - - { - "title": "Test Center", - "name": "test-center", - "version": "0.2.0", - "url": "https://github.com/akamai/cli-test-center", - "issues": "https://github.com/akamai/cli-test-center/issues", - "commands": [ - { - "name": "test-center", - "version": "0.2.0", - "description": "Test Center is a testing tool that checks the effect of configuration changes on your web property. Use this tool as part of your testing protocol to increase your confidence in the safety and accuracy of your configuration changes.", - "bin": "https://github.com/akamai/cli-test-center/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}" - } - ], - "requirements": {"go":"1.15"} - }, - - - - - - { - "title": "Visitor Prioritization", - "name": "visitor-prioritization", - "version": "v0.3.0", - "url": "https://github.com/akamai/cli-visitor-prioritization", - "issues": "https://github.com/akamai/cli-visitor-prioritization/issues", - "commands": [{"name":"visitor-prioritization","aliases":["vp"],"version":"0.3.0","description":"Access and control Visitor Prioritization cloudlet"}], - "requirements": {"python":"3.0.0"} - } - - ] -} diff --git a/assets/screen-1.png b/assets/screen-1.png deleted file mode 100644 index 3eab11e..0000000 Binary files a/assets/screen-1.png and /dev/null differ diff --git a/go.mod b/go.mod index 4578654..e35f006 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.5 github.com/Masterminds/semver v1.5.0 github.com/apex/log v1.9.0 - github.com/briandowns/spinner v1.11.1 + github.com/briandowns/spinner v1.23.0 github.com/fatih/color v1.10.0 github.com/go-git/go-git/v5 v5.4.2 github.com/go-ini/ini v1.62.0 diff --git a/go.sum b/go.sum index 8789abf..8b308d1 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/briandowns/spinner v1.11.1 h1:OixPqDEcX3juo5AjQZAnFPbeUA0jvkp2qzB5gOZJ/L0= -github.com/briandowns/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= +github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/pkg/apphelp/help_command_test.go b/pkg/apphelp/help_command_test.go index cf50704..778ff48 100644 --- a/pkg/apphelp/help_command_test.go +++ b/pkg/apphelp/help_command_test.go @@ -213,6 +213,65 @@ Global Flags: `, binarySuffix, binarySuffix), }, + "help for command with optional subcommands": { + args: []string{"test"}, + cmd: &cli.Command{ + Name: "test", + Description: "test command", + Category: "", + ArgsUsage: "", + Action: func(ctx *cli.Context) error { fmt.Println("oops!"); return nil }, + Subcommands: []*cli.Command{ + { + Name: "subcommand-no-category", + Description: "a test subcommand without a category", + }, + { + Name: "subcommand-with-aliases", + Description: "a test subcommand with aliases and without a category", + Aliases: []string{"sub-wa", "s-w-a"}, + }, + { + Name: "subcommand-in-category1", + Description: "a test subcommand in category 1", + Category: "category1", + }, + { + Name: "subcommand-in-category2", + Description: "a test subcommand in category 2", + Category: "category2", + }, + }, + }, + expectedOutput: fmt.Sprintf(` +Name: + apphelp.test%s test + +Usage: + apphelp.test%s [global flags] test [command flags] + apphelp.test%s [global flags] test [command flags] + +Description: + test command + +Subcommands: + subcommand-no-category + subcommand-with-aliases (aliases: sub-wa, s-w-a) + help (alias: h) +category1: + subcommand-in-category1 +category2: + subcommand-in-category2 + +Command Flags: + --help, -h show help (default: false) + +Global Flags: + --edgerc value, -e value edgerc config path passed to executed commands, defaults to ~/.edgerc + --section value, -s value edgerc section name passed to executed commands, defaults to 'default' +`, binarySuffix, binarySuffix, binarySuffix), + }, + "help for subcommand no category": { args: []string{"test", "subcommand-no-category"}, cmd: &cli.Command{ @@ -381,7 +440,3 @@ Command Flags: } } } - -//func TestIsBuiltinCommand(t *testing.T) { -// -//} diff --git a/pkg/apphelp/templates/subcommand_help.tmpl b/pkg/apphelp/templates/subcommand_help.tmpl index deb5a20..7d2cfab 100644 --- a/pkg/apphelp/templates/subcommand_help.tmpl +++ b/pkg/apphelp/templates/subcommand_help.tmpl @@ -3,6 +3,9 @@ {{.HelpName}} {{yellow "Usage:"}} +{{- if .ArgsUsage}} + {{insertString .HelpName "[global flags]" 1 | blue}}{{if .VisibleFlags}} {{blue "[command flags]"}}{{end}} {{blue .ArgsUsage}} +{{- end}} {{insertString .HelpName "[global flags]" 1 | blue}}{{if .VisibleFlags}} {{blue "[command flags]"}}{{end}} {{blue ""}} {{- if .Description}} diff --git a/pkg/commands/package_list/package-list.json b/pkg/commands/package_list/package-list.json index e73e07d..200553c 100644 --- a/pkg/commands/package_list/package-list.json +++ b/pkg/commands/package_list/package-list.json @@ -46,10 +46,10 @@ { "title": "Application Security", "name": "appsec", - "version": "2.3.0", + "version": "2.7.0", "url": "https://github.com/akamai/cli-appsec", "issues": "https://github.com/akamai/cli-appsec/issues", - "commands": [{"name":"appsec","version":"2.3.0","description":"Manage security configurations for Kona Site Defender and Client Reputation."}], + "commands": [{"name":"appsec","version":"2.7.0","description":"Akamai Security tools for protecting websites."}], "requirements": {"node":"7.0.0"} }, { @@ -67,13 +67,13 @@ "version": "v1.0.8", "url": "https://github.com/akamai/cli-cac", "issues": "https://github.com/akamai/cli-cac/issues", - "commands": [{"name":"cac","aliases":["cac"],"version":"v1.0.8","description":"Interface for Client Access Control (CAC) in the Akamai CLI tool"}], + "commands": [{"name":"cac","aliases":["cac"],"version":"v1.0.8","description":"An Akamai CLI package for Client Access Control"}], "requirements": {"python":"3.0.0"} }, { "title": "Certificate Provisioning Service (CPS)", "name": "cps", - "version": "v1.0.9", + "version": "v2.0.0", "url": "https://github.com/akamai/cli-cps", "issues": "https://github.com/akamai/cli-cps/issues", "commands": [ @@ -82,7 +82,7 @@ "aliases": [ "certs" ], - "version": "1.0.9", + "version": "2.0.0", "description": "Access Certificate Provisioning System (CPS) Information" } ], @@ -93,10 +93,10 @@ { "title": "Cloudlets", "name": "cloudlets", - "version": "v1.0.0", + "version": "v1.0.1", "url": "https://github.com/akamai/cli-cloudlets", "issues": "https://github.com/akamai/cli-cloudlets/issues", - "commands": [{"name":"cloudlets","aliases":["cloudlets"],"version":"1.0.0","description":"Manage cloudlet configurations"}], + "commands": [{"name":"cloudlets","aliases":["cloudlets"],"version":"1.0.1","description":"Manage Akamai Cloudlets"}], "requirements": {"python":"3.0.0"} }, { @@ -111,43 +111,43 @@ { "title": "EdgeWorkers", "name": "edgeworkers", - "version": "1.3.1", + "version": "1.7.3", "url": "https://github.com/akamai/cli-edgeworkers", "issues": "https://github.com/akamai/cli-edgeworkers/issues", "commands": [ - {"name":"edgeworkers","aliases":["ew", "edgeworkers"],"version":"1.3.1","description":"Akamai CLI for EdgeWorkers, allows you to interact with Akamai EdgeWorkers code bundles"}, - {"name":"edgekv","aliases":["ekw", "edgekv"],"version":"1.3.1","description":"Akamai CLI for EdgeWorkers, allows you to interact with Akamai EdgeKV database"} + {"name":"edgeworkers","aliases":["ew", "edgeworkers"],"version":"1.7.3","description":"Manage Akamai EdgeWorkers code bundles."}, + {"name":"edgekv","aliases":["ekv", "edgekv"],"version":"1.7.3","description":"Manage Akamai EdgeKV database."} ], "requirements": {"node":"7.0.0"} }, { "title": "Akamai Sandbox", "name": "sandbox", - "version": "v1.5.0", + "version": "v1.7.1", "url": "https://github.com/akamai/cli-sandbox", "issues": "https://github.com/akamai/cli-sandbox/issues", - "commands": [{"name":"sandbox","aliases":[""],"version":"1.5.0","description":"The Sandbox command line interface (CLI) expedites the process of creating an isolated development environment for testing changes to your website or property"}], - "requirements": {"node":"8.4.0"} + "commands": [{"name":"sandbox","version":"1.7.1","description":"Manage Akamai Sandbox environments.","bin": "https://github.com/akamai/cli-sandbox/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}-{{.Arch}}{{.BinSuffix}}"}], + "requirements": {"node":"14.21.3"} }, { "title": "Edge DNS", "name": "dns", - "version": "0.4.0", + "version": "0.5.0", "url": "https://github.com/akamai/cli-dns", "issues": "https://github.com/akamai/cli-dns/issues", - "commands": [{"name":"dns","version":"0.4.0","description":"Manage DNS zones with Edge DNS","bin":"https://github.com/akamai/cli-dns/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.12.0"} + "commands": [{"name":"dns","version":"0.5.0","description":"Manage DNS zones with Edge DNS","bin":"https://github.com/akamai/cli-dns/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], + "requirements": {"go":"1.18.0"} }, { "title": "Enterprise Application Access", "name": "eaa", - "version": "0.4.2", + "version": "0.5.7", "url": "https://github.com/akamai/cli-eaa", "issues": "https://github.com/akamai/cli-eaa/issues", "commands": [ { "name": "eaa", - "version": "0.4.2", + "version": "0.5.7", "description": "Akamai CLI for Enterprise Application Access (EAA)" } ], @@ -162,19 +162,19 @@ "url": "https://github.com/akamai/cli-firewall", "issues": "https://github.com/akamai/cli-firewall/issues", "commands": [ - {"name":"firewall","aliases":["fw"],"version":"0.2.1","description":"Access Akamai Firewall Rules Services, Subscriptions, and CIDRs"}, - {"name":"site-shield","aliases":["ss"],"version":"0.2.1","description":"Access details of Site-Shield Maps, CIDRs and acknowledgement"} + {"name":"firewall","aliases":["fw"],"version":"0.2.3","description":"Access Akamai Firewall Rules Services, Subscriptions, and CIDRs"}, + {"name":"site-shield","aliases":["ss"],"version":"0.2.3","description":"Access details of Site-Shield Maps, CIDRs and acknowledgement"} ], "requirements": {"python":"3.0.0"} }, { "title": "Global Traffic Management", "name": "gtm", - "version": "0.4.0", + "version": "0.5.0", "url": "https://github.com/akamai/cli-gtm", "issues": "https://github.com/akamai/cli-gtm/issues", - "commands": [{"name":"gtm","version":"0.4.0","description":"Limited Management of GTM domains","bin":"https://github.com/akamai/cli-gtm/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.8.0"} + "commands": [{"name":"gtm","version":"0.5.0","description":"Manage GTM Domains","bin":"https://github.com/akamai/cli-gtm/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], + "requirements": {"go":"1.18.0"} }, { "title": "Image Manager", @@ -191,7 +191,7 @@ { "title": "Jsonnet", "name": "jsonnet", - "version": "0.4.3", + "version": "0.8.0", "url": "https://github.com/akamai/cli-jsonnet", "issues": "https://github.com/akamai/cli-jsonnet/issues", "commands": [ @@ -200,12 +200,12 @@ "aliases": [ "jsonnet" ], - "version": "0.4.3", + "version": "0.8.0", "description": "Utilities for managing Akamai as jsonnet" } ], "requirements": { - "python": "3.0.0" + "python": "3.4.0" } }, { @@ -220,11 +220,11 @@ { "title": "Onboard", "name": "onboard", - "version": "1.0.3", + "version": "2.2.0", "url": "https://github.com/akamai/cli-onboard", "issues": "https://github.com/akamai/cli-onboard/issues", - "commands": [{"name":"onboard","aliases":["onboard"],"version":"1.0.3","description":"Onboard Akamai delivery and WAF configuration"}], - "requirements": {"python":"3.0.0"} + "commands": [{"name":"onboard","aliases":["onboard"],"version":"2.2.0","description":"Onboard Akamai delivery and WAF configuration"}], + "requirements": {"python":"3.6.0"} }, { "title": "Property Manager 1.0", @@ -242,28 +242,28 @@ "url": "https://github.com/akamai/cli-property-manager", "issues": "https://github.com/akamai/cli-property-manager/issues", "commands": [ - {"name":"snippets","aliases":["pm","property-manager"],"version":"0.7.7-RELEASE","description":"Property Manager CLI for DevOps"}, - {"name":"pipeline","aliases":["pl","pipeline","pd","proddeploy"],"version":"0.7.7-RELEASE","description":"Akamai Pipeline for DevOps"} + {"name":"snippets","aliases":["pm","property-manager"],"version":"0.7.8-RELEASE","description":"Property Manager CLI for DevOps"}, + {"name":"pipeline","aliases":["pl","pipeline","pd","proddeploy"],"version":"0.7.8-RELEASE","description":"Akamai Pipeline for DevOps"} ], "requirements": {"node":"8.9.1"} }, { "title": "Purge", "name": "purge", - "version": "1.0.1", + "version": "1.1.0", "url": "https://github.com/akamai/cli-purge", "issues": "https://github.com/akamai/cli-purge/issues", - "commands": [{"name":"purge","version":"1.0.1","description":"Purge content from the Edge","bin":"https://github.com/akamai/cli-purge/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.8.0"} + "commands": [{"name":"purge","version":"1.1.0","description":"Purge content from the Edge","bin":"https://github.com/akamai/cli-purge/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], + "requirements": {"go":"1.18.0"} }, { "title": "Terraform Client Configuration", - "name": "terraform", - "version": "0.3.0", + "name": "cli terraform", + "version": "1.5.0", "url": "https://github.com/akamai/cli-terraform", "issues": "https://github.com/akamai/cli-terraform/issues", - "commands": [{"name":"terraform","version":"0.3.0","description":"Create TF Configurations for Existing GTM domains, EdgeDNS zones and Property Manager properties","bin":"https://github.com/akamai/cli-terraform/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true}], - "requirements": {"go":"1.12.0"} + "commands": [{"name":"terraform","version":"1.5.0","description":"Administer and Manage Akamai Terraform configurations","bin":"https://github.com/akamai/cli-terraform/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}","auto-complete":true,"ldflags": "-X 'github.com/akamai/cli-terraform/cli.Version=%s'"}], + "requirements": {"go":"1.18.0"} }, { "title": "Test Center", diff --git a/pkg/terminal/spinner.go b/pkg/terminal/spinner.go index adb7c4c..02e62b4 100644 --- a/pkg/terminal/spinner.go +++ b/pkg/terminal/spinner.go @@ -31,10 +31,10 @@ type ( // SpinnerStatus strings var ( - SpinnerStatusOK = SpinnerStatus(fmt.Sprintf("... [%s]\n", color.GreenString("OK"))) - SpinnerStatusWarnOK = SpinnerStatus(fmt.Sprintf("... [%s]\n", color.CyanString("OK"))) - SpinnerStatusWarn = SpinnerStatus(fmt.Sprintf("... [%s]\n", color.CyanString("WARN"))) - SpinnerStatusFail = SpinnerStatus(fmt.Sprintf("... [%s]\n", color.RedString("FAIL"))) + SpinnerStatusOK = SpinnerStatus(fmt.Sprintf("[%s]\n", color.GreenString("OK"))) + SpinnerStatusWarnOK = SpinnerStatus(fmt.Sprintf("[%s]\n", color.CyanString("OK"))) + SpinnerStatusWarn = SpinnerStatus(fmt.Sprintf("[%s]\n", color.CyanString("WARN"))) + SpinnerStatusFail = SpinnerStatus(fmt.Sprintf("[%s]\n", color.RedString("FAIL"))) ) // StandardSpinner returns a default spinner for Akamai CLI diff --git a/pkg/terminal/spinner_test.go b/pkg/terminal/spinner_test.go index e97529f..70ccdd3 100644 --- a/pkg/terminal/spinner_test.go +++ b/pkg/terminal/spinner_test.go @@ -11,21 +11,18 @@ import ( ) func TestStart(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } + t.Cleanup(func() { + s.spinner.Stop() + }) + s.Start("spinner %s", "test") - for i := 0; i < 10; i++ { - time.Sleep(100 * time.Millisecond) - s.spinner.Lock() - if wr.Len() > 0 { - assert.Contains(t, wr.String(), "spinner test .") - return - } - s.spinner.Unlock() - } - t.Fatal("no input on writer") + + s.spinner.Lock() + assert.Contains(t, s.spinner.Prefix, "spinner test") + s.spinner.Unlock() } func TestStop(t *testing.T) { @@ -35,73 +32,68 @@ func TestStop(t *testing.T) { }{ "stop spinner OK": { spinnerStatus: SpinnerStatusOK, - expected: "... [OK]", + expected: "[OK]", }, "stop spinner WARN OK": { spinnerStatus: SpinnerStatusWarnOK, - expected: "... [OK]", + expected: "[OK]", }, "stop spinner WARN": { spinnerStatus: SpinnerStatusWarn, - expected: "... [WARN]", + expected: "[WARN]", }, "stop spinner FAIL": { spinnerStatus: SpinnerStatusFail, - expected: "... [FAIL]", + expected: "[FAIL]", }, } for name, test := range tests { t.Run(name, func(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } s.Start("spinner %s", "test") s.Stop(test.spinnerStatus) - assert.Contains(t, wr.String(), fmt.Sprintf("spinner test %s", test.expected)) + assert.Contains(t, s.spinner.FinalMSG, fmt.Sprintf("spinner test %s", test.expected)) }) } } func TestOK(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } s.Start("spinner %s", "test") s.OK() - assert.Contains(t, wr.String(), "spinner test ... [OK]") + assert.Contains(t, s.spinner.FinalMSG, "spinner test [OK]") } func TestWarn(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } s.Start("spinner %s", "test") s.Warn() - assert.Contains(t, wr.String(), "spinner test ... [WARN]") + assert.Contains(t, s.spinner.FinalMSG, "spinner test [WARN]") } func TestWarnOK(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } s.Start("spinner %s", "test") s.WarnOK() - assert.Contains(t, wr.String(), "spinner test ... [OK]") + assert.Contains(t, s.spinner.FinalMSG, "spinner test [OK]") } func TestFail(t *testing.T) { - wr := bytes.Buffer{} s := DefaultSpinner{ - spinner: spnr.New(spnr.CharSets[26], 1*time.Minute, spnr.WithWriter(&wr)), + spinner: spnr.New(spnr.CharSets[26], 1*time.Minute), } s.Start("spinner %s", "test") s.Fail() - assert.Contains(t, wr.String(), fmt.Sprintf("spinner test ... [FAIL]")) + assert.Contains(t, s.spinner.FinalMSG, fmt.Sprintf("spinner test [FAIL]")) } func TestSpinnerWrite(t *testing.T) { diff --git a/pkg/version/version.go b/pkg/version/version.go index 0b1092c..62d4ee0 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -4,7 +4,7 @@ import "github.com/Masterminds/semver" const ( // Version Application Version - Version = "1.5.4" + Version = "1.5.5" // Equals p1==p2 in version.Compare(p1, p2) Equals = 0 // Error failure parsing one of the parameters in version.Compare(p1, p2)