mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Allow deleting config vars with 'env rm'
Resolves: #1459 Change-type: minor Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
parent
863eae42c5
commit
d463a2f0e5
@ -607,13 +607,14 @@ produce verbose output
|
||||
|
||||
## env rm ID
|
||||
|
||||
Remove an environment variable from an application or device, as selected
|
||||
by command-line options.
|
||||
Remove a configuration or environment variable from an application or device,
|
||||
as selected by command-line options.
|
||||
|
||||
Note that this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
The --device option selects a device instead of an application.
|
||||
The --config option selects a config var instead of an env var.
|
||||
|
||||
Service-specific variables are not currently supported. The following
|
||||
examples remove variables that apply to all services in an app or device.
|
||||
@ -622,7 +623,9 @@ Examples:
|
||||
|
||||
$ balena env rm 215
|
||||
$ balena env rm 215 --yes
|
||||
$ balena env rm 215 --config
|
||||
$ balena env rm 215 --device
|
||||
$ balena env rm 215 --device --config
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -636,6 +639,10 @@ environment variable numeric database ID
|
||||
|
||||
Selects a device environment variable instead of an application environment variable
|
||||
|
||||
#### -c, --config
|
||||
|
||||
Selects a configuration variable instead of an environment variable
|
||||
|
||||
#### -y, --yes
|
||||
|
||||
Run in non-interactive mode
|
||||
|
20
lib/actions-oclif/env/rm.ts
vendored
20
lib/actions-oclif/env/rm.ts
vendored
@ -21,6 +21,7 @@ import { stripIndent } from 'common-tags';
|
||||
import { CommandHelp } from '../../utils/oclif-utils';
|
||||
|
||||
interface FlagsDef {
|
||||
config: boolean;
|
||||
device: boolean;
|
||||
yes: boolean;
|
||||
}
|
||||
@ -33,13 +34,14 @@ export default class EnvRmCmd extends Command {
|
||||
public static description = stripIndent`
|
||||
Remove an environment variable from an application or device.
|
||||
|
||||
Remove an environment variable from an application or device, as selected
|
||||
by command-line options.
|
||||
Remove a configuration or environment variable from an application or device,
|
||||
as selected by command-line options.
|
||||
|
||||
Note that this command asks for confirmation interactively.
|
||||
You can avoid this by passing the \`--yes\` boolean option.
|
||||
|
||||
The --device option selects a device instead of an application.
|
||||
The --config option selects a config var instead of an env var.
|
||||
|
||||
Service-specific variables are not currently supported. The following
|
||||
examples remove variables that apply to all services in an app or device.
|
||||
@ -47,7 +49,9 @@ export default class EnvRmCmd extends Command {
|
||||
public static examples = [
|
||||
'$ balena env rm 215',
|
||||
'$ balena env rm 215 --yes',
|
||||
'$ balena env rm 215 --config',
|
||||
'$ balena env rm 215 --device',
|
||||
'$ balena env rm 215 --device --config',
|
||||
];
|
||||
|
||||
public static args = [
|
||||
@ -69,6 +73,12 @@ export default class EnvRmCmd extends Command {
|
||||
'Selects a device environment variable instead of an application environment variable',
|
||||
default: false,
|
||||
}),
|
||||
config: flags.boolean({
|
||||
char: 'c',
|
||||
description:
|
||||
'Selects a configuration variable instead of an environment variable',
|
||||
default: false,
|
||||
}),
|
||||
yes: flags.boolean({
|
||||
char: 'y',
|
||||
description: 'Run in non-interactive mode',
|
||||
@ -103,7 +113,11 @@ export default class EnvRmCmd extends Command {
|
||||
|
||||
await balena.pine.delete({
|
||||
resource: options.device
|
||||
? 'device_environment_variable'
|
||||
? options.config
|
||||
? 'device_config_variable'
|
||||
: 'device_environment_variable'
|
||||
: options.config
|
||||
? 'application_config_variable'
|
||||
: 'application_environment_variable',
|
||||
id: params.id,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user