Add alias tag list for tags command

Change-type: minor
This commit is contained in:
myarmolinsky 2024-09-25 07:47:38 -04:00
parent bd1b71bf2f
commit 5eba175bf1
10 changed files with 78 additions and 69 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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

View File

@ -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
`;
}

View File

@ -84,9 +84,9 @@ ADDITIONAL COMMANDS
os initialize <image> initialize an os image for a device
os versions <type> show available balenaOS versions for the given device type
settings print current settings
tag rm <tagKey> remove a tag from an application, device or release
tag set <tagKey> [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 <tagKey> remove a tag from an app, block, fleet, device or release
tag set <tagKey> [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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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