mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
balena device note
Change-type: patch
This commit is contained in:
parent
01a81b3551
commit
ef6d37f073
@ -1678,10 +1678,6 @@ note content
|
||||
|
||||
device UUID
|
||||
|
||||
#### --dev DEV
|
||||
|
||||
|
||||
|
||||
## device os-update
|
||||
|
||||
### Description
|
||||
|
@ -68,7 +68,7 @@ export default class ConfigGenerateCmd extends Command {
|
||||
dev: cf.dev,
|
||||
secureBoot: cf.secureBoot,
|
||||
device: {
|
||||
...cf.device,
|
||||
...cf.device(),
|
||||
exclusive: [
|
||||
'fleet',
|
||||
'provisioning-key-name',
|
||||
|
@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Flags, Args, Command } from '@oclif/core';
|
||||
import { ExpectedError } from '../../errors';
|
||||
import { Args, Command } from '@oclif/core';
|
||||
import * as cf from '../../utils/common-flags';
|
||||
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
|
||||
|
||||
@ -41,35 +40,24 @@ export default class DeviceNoteCmd extends Command {
|
||||
public static args = {
|
||||
note: Args.string({
|
||||
description: 'note content',
|
||||
required: true,
|
||||
}),
|
||||
};
|
||||
|
||||
public static flags = {
|
||||
device: { exclusive: ['dev'], ...cf.device },
|
||||
dev: Flags.string({
|
||||
exclusive: ['device'],
|
||||
hidden: true,
|
||||
}),
|
||||
device: cf.device({ required: true }),
|
||||
};
|
||||
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(DeviceNoteCmd);
|
||||
|
||||
if (params.note?.length === 0) {
|
||||
throw new ExpectedError('Missing note content');
|
||||
}
|
||||
|
||||
options.device = options.device || options.dev;
|
||||
delete options.dev;
|
||||
|
||||
if (options.device == null || options.device.length === 0) {
|
||||
throw new ExpectedError('Missing device UUID (--device)');
|
||||
}
|
||||
const {
|
||||
args: params,
|
||||
flags: { device },
|
||||
} = await this.parse(DeviceNoteCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
return balena.models.device.setNote(options.device, params.note ?? '');
|
||||
return balena.models.device.setNote(device!, params.note!);
|
||||
}
|
||||
}
|
||||
|
2
src/commands/env/list.ts
vendored
2
src/commands/env/list.ts
vendored
@ -104,7 +104,7 @@ export default class EnvListCmd extends Command {
|
||||
description: 'show configuration variables only',
|
||||
exclusive: ['service'],
|
||||
}),
|
||||
device: { ...cf.device, exclusive: ['fleet'] },
|
||||
device: { ...cf.device(), exclusive: ['fleet'] },
|
||||
json: cf.json,
|
||||
service: { ...cf.service, exclusive: ['config'] },
|
||||
};
|
||||
|
2
src/commands/env/set.ts
vendored
2
src/commands/env/set.ts
vendored
@ -96,7 +96,7 @@ export default class EnvSetCmd extends Command {
|
||||
|
||||
public static flags = {
|
||||
fleet: { ...cf.fleet(), exclusive: ['device'] },
|
||||
device: { ...cf.device, exclusive: ['fleet'] },
|
||||
device: { ...cf.device(), exclusive: ['fleet'] },
|
||||
quiet: cf.quiet,
|
||||
service: cf.service,
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ export default class OsConfigureCmd extends Command {
|
||||
dev: cf.dev,
|
||||
secureBoot: cf.secureBoot,
|
||||
device: {
|
||||
...cf.device,
|
||||
...cf.device(),
|
||||
exclusive: [
|
||||
'fleet',
|
||||
'provisioning-key-name',
|
||||
|
@ -47,7 +47,7 @@ export default class TagListCmd extends Command {
|
||||
exclusive: ['device', 'release'],
|
||||
},
|
||||
device: {
|
||||
...cf.device,
|
||||
...cf.device(),
|
||||
exclusive: ['fleet', 'release'],
|
||||
},
|
||||
release: {
|
||||
|
@ -50,7 +50,7 @@ export default class TagRmCmd extends Command {
|
||||
exclusive: ['device', 'release'],
|
||||
},
|
||||
device: {
|
||||
...cf.device,
|
||||
...cf.device(),
|
||||
exclusive: ['fleet', 'release'],
|
||||
},
|
||||
release: {
|
||||
|
@ -64,7 +64,7 @@ export default class TagSetCmd extends Command {
|
||||
exclusive: ['device', 'release'],
|
||||
},
|
||||
device: {
|
||||
...cf.device,
|
||||
...cf.device(),
|
||||
exclusive: ['fleet', 'release'],
|
||||
},
|
||||
release: {
|
||||
|
@ -28,10 +28,13 @@ export const fleet = (extraOpts?: Partial<typeof Flags.string>) =>
|
||||
...extraOpts,
|
||||
});
|
||||
|
||||
export const device = Flags.string({
|
||||
char: 'd',
|
||||
description: 'device UUID',
|
||||
});
|
||||
// eslint-disable-next-line id-denylist
|
||||
export const device = (extraOpts?: Partial<typeof Flags.string>) =>
|
||||
Flags.string({
|
||||
char: 'd',
|
||||
description: 'device UUID',
|
||||
...extraOpts,
|
||||
});
|
||||
|
||||
export const quiet = Flags.boolean({
|
||||
char: 'q',
|
||||
|
Loading…
Reference in New Issue
Block a user