Add alias api-key list for command api-keys

Change-type: minor
This commit is contained in:
myarmolinsky 2024-09-24 12:47:00 -04:00
parent a1e936bb3f
commit cad5543863
10 changed files with 49 additions and 41 deletions

View File

@ -52,7 +52,6 @@ interface Documentation {
// Mapping folders names to custom headings in the docs // Mapping folders names to custom headings in the docs
const commandHeadings: { [key: string]: string } = { const commandHeadings: { [key: string]: string } = {
'api-key': 'API Keys', 'api-key': 'API Keys',
'api-keys': 'API Keys',
login: 'Authentication', login: 'Authentication',
whoami: 'Authentication', whoami: 'Authentication',
logout: 'Authentication', logout: 'Authentication',

View File

@ -8,9 +8,9 @@ _balena() {
local context state line curcontext="$curcontext" local context state line curcontext="$curcontext"
# Valid top-level completions # 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 # Sub-completions
api_key_cmds=( generate revoke ) api_key_cmds=( generate list revoke )
app_cmds=( create ) app_cmds=( create )
block_cmds=( create ) block_cmds=( create )
config_cmds=( generate inject read reconfigure write ) config_cmds=( generate inject read reconfigure write )

View File

@ -7,9 +7,9 @@ _balena_complete()
local cur prev local cur prev
# Valid top-level completions # 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 # Sub-completions
api_key_cmds="generate revoke" api_key_cmds="generate list revoke"
app_cmds="create" app_cmds="create"
block_cmds="create" block_cmds="create"
config_cmds="generate inject read reconfigure write" config_cmds="generate inject read reconfigure write"

View File

@ -163,8 +163,8 @@ are encouraged to regularly update the balena CLI to the latest version.
- API Keys - API Keys
- [api-key generate](#api-key-generate) - [api-key generate](#api-key-generate)
- [api-key list](#api-key-list)
- [api-key revoke](#api-key-revoke) - [api-key revoke](#api-key-revoke)
- [api-keys](#api-keys)
- Apps - Apps
@ -341,6 +341,35 @@ the API key name
### Options ### 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 ## api-key revoke
### Description ### Description
@ -363,28 +392,6 @@ the API key ids
### Options ### 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 # Apps
## app create ## app create

View File

@ -19,7 +19,9 @@ import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy'; 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` public static description = stripIndent`
Print a list of balenaCloud API keys. 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. 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 = { public static flags = {
help: cf.help, help: cf.help,
@ -41,7 +43,7 @@ export default class ApiKeysCmd extends Command {
public static authenticated = true; public static authenticated = true;
public async run() { public async run() {
const { flags: options } = await this.parse(ApiKeysCmd); const { flags: options } = await this.parse(APIKeyListCmd);
const { getApplication } = await import('../../utils/sdk'); const { getApplication } = await import('../../utils/sdk');
const actorId = options.fleet const actorId = options.fleet

View File

@ -33,10 +33,10 @@
%2: build/commands/api-key/generate.js %2: build/commands/api-key/generate.js
> Warning Entry 'main' not found in %1 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %1: node_modules/@oclif/core/package.json
%2: build/commands/app/create.js %2: build/commands/app/create.js

View File

@ -33,10 +33,10 @@
%2: build/commands/api-key/generate.js %2: build/commands/api-key/generate.js
> Warning Entry 'main' not found in %1 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %1: node_modules/@oclif/core/package.json
%2: build/commands/app/create.js %2: build/commands/app/create.js

View File

@ -33,10 +33,10 @@
%2: build/commands/api-key/generate.js %2: build/commands/api-key/generate.js
> Warning Entry 'main' not found in %1 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %1: node_modules/@oclif/core/package.json
%2: build/commands/app/create.js %2: build/commands/app/create.js

View File

@ -33,10 +33,10 @@
%2: build/commands/api-key/generate.js %2: build/commands/api-key/generate.js
> Warning Entry 'main' not found in %1 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json %1: node_modules/@oclif/core/package.json
%2: build/commands/app/create.js %2: build/commands/app/create.js

View File

@ -33,10 +33,10 @@
%2: build\commands\api-key\generate.js %2: build\commands\api-key\generate.js
> Warning Entry 'main' not found in %1 > Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json %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 > Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json %1: node_modules\@oclif\core\package.json
%2: build\commands\app\create.js %2: build\commands\app\create.js