diff --git a/completion/_balena b/completion/_balena index 0673af7e..f85d784e 100644 --- a/completion/_balena +++ b/completion/_balena @@ -8,7 +8,7 @@ _balena() { local context state line curcontext="$curcontext" # Valid top-level completions - main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout logs notes orgs os preload push release scan settings ssh ssh-key support tag tags tunnel util version whoami ) + main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout logs notes orgs os preload push release scan settings ssh ssh-key support tag tunnel util version whoami ) # Sub-completions api_key_cmds=( generate list revoke ) app_cmds=( create ) @@ -23,7 +23,7 @@ _balena() { os_cmds=( build-config configure download initialize versions ) release_cmds=( finalize invalidate list validate ) ssh_key_cmds=( add list rm ) - tag_cmds=( rm set ) + tag_cmds=( list rm set ) _arguments -C \ diff --git a/completion/balena-completion.bash b/completion/balena-completion.bash index 08e272e3..664ff1fa 100644 --- a/completion/balena-completion.bash +++ b/completion/balena-completion.bash @@ -7,7 +7,7 @@ _balena_complete() local cur prev # Valid top-level completions - main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout logs notes orgs os preload push release scan settings ssh ssh-key support tag tags tunnel util version whoami" + main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout logs notes orgs os preload push release scan settings ssh ssh-key support tag tunnel util version whoami" # Sub-completions api_key_cmds="generate list revoke" app_cmds="create" @@ -22,7 +22,7 @@ _balena_complete() os_cmds="build-config configure download initialize versions" release_cmds="finalize invalidate list validate" ssh_key_cmds="add list rm" - tag_cmds="rm set" + tag_cmds="list rm set" diff --git a/docs/balena-cli.md b/docs/balena-cli.md index 2e219778..a4636993 100644 --- a/docs/balena-cli.md +++ b/docs/balena-cli.md @@ -305,9 +305,9 @@ are encouraged to regularly update the balena CLI to the latest version. - Tags + - [tag list](#tag-list) - [tag rm](#tag-rm) - [tag set](#tag-set) - - [tags](#tags) - Utilities @@ -3850,6 +3850,51 @@ length of time to enable support for, in (h)ours or (d)ays, e.g. 12h, 2d # Tags +## tag list + +### Aliases + +- `tags` + + +To use one of the aliases, replace `tag list` with the alias. + +### Description + +List all tags and their values for the specified fleet, device or release. + +Fleets may be specified by fleet name or slug. Fleet slugs are +the recommended option, as they are unique and unambiguous. Slugs can be +listed with the `balena fleet list` command. Note that slugs may change if the +fleet is renamed. Fleet names are not unique and may result in "Fleet is +ambiguous" errors at any time (even if it "used to work in the past"), for +example if the name clashes with a newly created public fleet, or with fleets +from other balena accounts that you may be invited to join under any role. +For this reason, fleet names are especially discouraged in scripts (e.g. CI +environments). + +Examples: + + $ balena tag list --fleet MyFleet + $ balena tag list -f myorg/myfleet + $ balena tag list --device 7cf02a6 + $ balena tag list --release 1234 + $ balena tag list --release b376b0e544e9429483b656490e5b9443b4349bd6 + +### Options + +#### -f, --fleet FLEET + +fleet name or slug (preferred) + +#### -d, --device DEVICE + +device UUID + +#### -r, --release RELEASE + +release id + ## tag rm ### Description @@ -3949,44 +3994,6 @@ device UUID release id -## tags - -### Description - -List all tags and their values for the specified fleet, device or release. - -Fleets may be specified by fleet name or slug. Fleet slugs are -the recommended option, as they are unique and unambiguous. Slugs can be -listed with the `balena fleet list` command. Note that slugs may change if the -fleet is renamed. Fleet names are not unique and may result in "Fleet is -ambiguous" errors at any time (even if it "used to work in the past"), for -example if the name clashes with a newly created public fleet, or with fleets -from other balena accounts that you may be invited to join under any role. -For this reason, fleet names are especially discouraged in scripts (e.g. CI -environments). - -Examples: - - $ balena tags --fleet MyFleet - $ balena tags -f myorg/myfleet - $ balena tags --device 7cf02a6 - $ balena tags --release 1234 - $ balena tags --release b376b0e544e9429483b656490e5b9443b4349bd6 - -### Options - -#### -f, --fleet FLEET - -fleet name or slug (preferred) - -#### -d, --device DEVICE - -device UUID - -#### -r, --release RELEASE - -release id - # Utilities ## util available-drives diff --git a/src/commands/tag/list.ts b/src/commands/tag/list.ts index 79b90229..509ed9e8 100644 --- a/src/commands/tag/list.ts +++ b/src/commands/tag/list.ts @@ -21,7 +21,9 @@ import * as cf from '../../utils/common-flags'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy'; import { applicationIdInfo } from '../../utils/messages'; -export default class TagsCmd extends Command { +export default class TagListCmd extends Command { + public static aliases = ['tags']; + public static description = stripIndent` List all tags for a fleet, device or release. @@ -31,11 +33,11 @@ export default class TagsCmd extends Command { `; public static examples = [ - '$ balena tags --fleet MyFleet', - '$ balena tags -f myorg/myfleet', - '$ balena tags --device 7cf02a6', - '$ balena tags --release 1234', - '$ balena tags --release b376b0e544e9429483b656490e5b9443b4349bd6', + '$ balena tag list --fleet MyFleet', + '$ balena tag list -f myorg/myfleet', + '$ balena tag list --device 7cf02a6', + '$ balena tag list --release 1234', + '$ balena tag list --release b376b0e544e9429483b656490e5b9443b4349bd6', ]; public static flags = { @@ -57,7 +59,7 @@ export default class TagsCmd extends Command { public static authenticated = true; public async run() { - const { flags: options } = await this.parse(TagsCmd); + const { flags: options } = await this.parse(TagListCmd); const balena = getBalenaSdk(); @@ -105,6 +107,6 @@ export default class TagsCmd extends Command { See the help page for examples: - $ balena help tags + $ balena help tag list `; } diff --git a/tests/commands/help.spec.ts b/tests/commands/help.spec.ts index e9268c75..48385e3d 100644 --- a/tests/commands/help.spec.ts +++ b/tests/commands/help.spec.ts @@ -84,9 +84,9 @@ ADDITIONAL COMMANDS os initialize initialize an os image for a device os versions show available balenaOS versions for the given device type settings print current settings - tag rm remove a tag from an application, device or release - tag set [value] set a tag on an application, device or release - tags list all tags for an application, device or release + tag list list all tags for a app, block, fleet, device or release + tag rm remove a tag from an app, block, fleet, device or release + tag set [value] set a tag on an app, block, fleet, device or release util available-drives list available drives version display version information for the balena CLI and/or Node.js whoami display account information for current user diff --git a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt index 44d43540..0c9d6467 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt @@ -256,15 +256,15 @@ > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/support/index.js +> Warning Entry 'main' not found in %1 + %1: node_modules/@oclif/core/package.json + %2: build/commands/tag/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/rm.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/set.js -> Warning Entry 'main' not found in %1 - %1: node_modules/@oclif/core/package.json - %2: build/commands/tags/index.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tunnel/index.js diff --git a/tests/test-data/pkg/expected-warnings-darwin-x64.txt b/tests/test-data/pkg/expected-warnings-darwin-x64.txt index 92d5ebaa..f9f6649d 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-x64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-x64.txt @@ -256,15 +256,15 @@ > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/support/index.js +> Warning Entry 'main' not found in %1 + %1: node_modules/@oclif/core/package.json + %2: build/commands/tag/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/rm.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/set.js -> Warning Entry 'main' not found in %1 - %1: node_modules/@oclif/core/package.json - %2: build/commands/tags/index.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tunnel/index.js diff --git a/tests/test-data/pkg/expected-warnings-linux-arm64.txt b/tests/test-data/pkg/expected-warnings-linux-arm64.txt index 44d43540..0c9d6467 100644 --- a/tests/test-data/pkg/expected-warnings-linux-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-arm64.txt @@ -256,15 +256,15 @@ > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/support/index.js +> Warning Entry 'main' not found in %1 + %1: node_modules/@oclif/core/package.json + %2: build/commands/tag/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/rm.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/set.js -> Warning Entry 'main' not found in %1 - %1: node_modules/@oclif/core/package.json - %2: build/commands/tags/index.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tunnel/index.js diff --git a/tests/test-data/pkg/expected-warnings-linux-x64.txt b/tests/test-data/pkg/expected-warnings-linux-x64.txt index 92d5ebaa..f9f6649d 100644 --- a/tests/test-data/pkg/expected-warnings-linux-x64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-x64.txt @@ -256,15 +256,15 @@ > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/support/index.js +> Warning Entry 'main' not found in %1 + %1: node_modules/@oclif/core/package.json + %2: build/commands/tag/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/rm.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tag/set.js -> Warning Entry 'main' not found in %1 - %1: node_modules/@oclif/core/package.json - %2: build/commands/tags/index.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/tunnel/index.js diff --git a/tests/test-data/pkg/expected-warnings-win32-x64.txt b/tests/test-data/pkg/expected-warnings-win32-x64.txt index a5639153..6961872a 100644 --- a/tests/test-data/pkg/expected-warnings-win32-x64.txt +++ b/tests/test-data/pkg/expected-warnings-win32-x64.txt @@ -256,15 +256,15 @@ > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json %2: build\commands\support\index.js +> Warning Entry 'main' not found in %1 + %1: node_modules\@oclif\core\package.json + %2: build\commands\tag\list.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json %2: build\commands\tag\rm.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json %2: build\commands\tag\set.js -> Warning Entry 'main' not found in %1 - %1: node_modules\@oclif\core\package.json - %2: build\commands\tags\index.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json %2: build\commands\tunnel\index.js