diff --git a/automation/capitanodoc/capitanodoc.ts b/automation/capitanodoc/capitanodoc.ts index 9df2aed4..34045793 100644 --- a/automation/capitanodoc/capitanodoc.ts +++ b/automation/capitanodoc/capitanodoc.ts @@ -52,7 +52,6 @@ interface Documentation { // Mapping folders names to custom headings in the docs const commandHeadings: { [key: string]: string } = { 'api-key': 'API Keys', - 'api-keys': 'API Keys', login: 'Authentication', whoami: 'Authentication', logout: 'Authentication', diff --git a/completion/_balena b/completion/_balena index 70bdfc0f..4bb86a00 100644 --- a/completion/_balena +++ b/completion/_balena @@ -8,9 +8,9 @@ _balena() { local context state line curcontext="$curcontext" # Valid top-level completions - main_commands=( api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami ) + main_commands=( api-key app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami ) # Sub-completions - api_key_cmds=( generate revoke ) + api_key_cmds=( generate list revoke ) app_cmds=( create ) block_cmds=( create ) config_cmds=( generate inject read reconfigure write ) diff --git a/completion/balena-completion.bash b/completion/balena-completion.bash index 95e826ad..eca87c36 100644 --- a/completion/balena-completion.bash +++ b/completion/balena-completion.bash @@ -7,9 +7,9 @@ _balena_complete() local cur prev # Valid top-level completions - main_commands="api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami" + main_commands="api-key app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami" # Sub-completions - api_key_cmds="generate revoke" + api_key_cmds="generate list revoke" app_cmds="create" block_cmds="create" config_cmds="generate inject read reconfigure write" diff --git a/docs/balena-cli.md b/docs/balena-cli.md index 50fbe551..532d3c5c 100644 --- a/docs/balena-cli.md +++ b/docs/balena-cli.md @@ -163,8 +163,8 @@ are encouraged to regularly update the balena CLI to the latest version. - API Keys - [api-key generate](#api-key-generate) + - [api-key list](#api-key-list) - [api-key revoke](#api-key-revoke) - - [api-keys](#api-keys) - Apps @@ -341,6 +341,35 @@ the API key name ### Options +## api-key list + +### Aliases + +- `api-keys` + + +To use one of the aliases, replace `api-key list` with the alias. + +### Description + +Print a list of balenaCloud API keys. + +Print a list of balenaCloud API keys for the current user or for a specific fleet with the `--fleet` option. + +Examples: + + $ balena api-key list + +### Options + +#### -u, --user + +show API keys for your user + +#### -f, --fleet FLEET + +fleet name or slug (preferred) + ## api-key revoke ### Description @@ -363,28 +392,6 @@ the API key ids ### Options -## api-keys - -### Description - -Print a list of balenaCloud API keys. - -Print a list of balenaCloud API keys for the current user or for a specific fleet with the `--fleet` option. - -Examples: - - $ balena api-keys - -### Options - -#### -u, --user - -show API keys for your user - -#### -f, --fleet FLEET - -fleet name or slug (preferred) - # Apps ## app create diff --git a/src/commands/api-key/list.ts b/src/commands/api-key/list.ts index 560c83fb..cecbcdfa 100644 --- a/src/commands/api-key/list.ts +++ b/src/commands/api-key/list.ts @@ -19,7 +19,9 @@ import { Flags, Command } from '@oclif/core'; import * as cf from '../../utils/common-flags'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy'; -export default class ApiKeysCmd extends Command { +export default class APIKeyListCmd extends Command { + public static aliases = ['api-keys']; + public static description = stripIndent` Print a list of balenaCloud API keys. @@ -27,7 +29,7 @@ export default class ApiKeysCmd extends Command { Print a list of balenaCloud API keys for the current user or for a specific fleet with the \`--fleet\` option. `; - public static examples = ['$ balena api-keys']; + public static examples = ['$ balena api-key list']; public static flags = { help: cf.help, @@ -41,7 +43,7 @@ export default class ApiKeysCmd extends Command { public static authenticated = true; public async run() { - const { flags: options } = await this.parse(ApiKeysCmd); + const { flags: options } = await this.parse(APIKeyListCmd); const { getApplication } = await import('../../utils/sdk'); const actorId = options.fleet diff --git a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt index cc9ad867..32bd2b82 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt @@ -33,10 +33,10 @@ %2: build/commands/api-key/generate.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-key/revoke.js + %2: build/commands/api-key/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-keys/index.js + %2: build/commands/api-key/revoke.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/app/create.js diff --git a/tests/test-data/pkg/expected-warnings-darwin-x64.txt b/tests/test-data/pkg/expected-warnings-darwin-x64.txt index fee5b5d2..5544e60b 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-x64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-x64.txt @@ -33,10 +33,10 @@ %2: build/commands/api-key/generate.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-key/revoke.js + %2: build/commands/api-key/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-keys/index.js + %2: build/commands/api-key/revoke.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/app/create.js diff --git a/tests/test-data/pkg/expected-warnings-linux-arm64.txt b/tests/test-data/pkg/expected-warnings-linux-arm64.txt index cc9ad867..32bd2b82 100644 --- a/tests/test-data/pkg/expected-warnings-linux-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-arm64.txt @@ -33,10 +33,10 @@ %2: build/commands/api-key/generate.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-key/revoke.js + %2: build/commands/api-key/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-keys/index.js + %2: build/commands/api-key/revoke.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/app/create.js diff --git a/tests/test-data/pkg/expected-warnings-linux-x64.txt b/tests/test-data/pkg/expected-warnings-linux-x64.txt index fee5b5d2..5544e60b 100644 --- a/tests/test-data/pkg/expected-warnings-linux-x64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-x64.txt @@ -33,10 +33,10 @@ %2: build/commands/api-key/generate.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-key/revoke.js + %2: build/commands/api-key/list.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json - %2: build/commands/api-keys/index.js + %2: build/commands/api-key/revoke.js > Warning Entry 'main' not found in %1 %1: node_modules/@oclif/core/package.json %2: build/commands/app/create.js diff --git a/tests/test-data/pkg/expected-warnings-win32-x64.txt b/tests/test-data/pkg/expected-warnings-win32-x64.txt index ed6eba29..c6ef3d6f 100644 --- a/tests/test-data/pkg/expected-warnings-win32-x64.txt +++ b/tests/test-data/pkg/expected-warnings-win32-x64.txt @@ -33,10 +33,10 @@ %2: build\commands\api-key\generate.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json - %2: build\commands\api-key\revoke.js + %2: build\commands\api-key\list.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json - %2: build\commands\api-keys\index.js + %2: build\commands\api-key\revoke.js > Warning Entry 'main' not found in %1 %1: node_modules\@oclif\core\package.json %2: build\commands\app\create.js