balena device note

Change-type: patch
This commit is contained in:
myarmolinsky 2024-11-05 07:57:30 -05:00
parent 01a81b3551
commit ef6d37f073
10 changed files with 22 additions and 35 deletions

View File

@ -1678,10 +1678,6 @@ note content
device UUID
#### --dev DEV
## device os-update
### Description

View File

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

View File

@ -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!);
}
}

View File

@ -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'] },
};

View File

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

View File

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

View File

@ -47,7 +47,7 @@ export default class TagListCmd extends Command {
exclusive: ['device', 'release'],
},
device: {
...cf.device,
...cf.device(),
exclusive: ['fleet', 'release'],
},
release: {

View File

@ -50,7 +50,7 @@ export default class TagRmCmd extends Command {
exclusive: ['device', 'release'],
},
device: {
...cf.device,
...cf.device(),
exclusive: ['fleet', 'release'],
},
release: {

View File

@ -64,7 +64,7 @@ export default class TagSetCmd extends Command {
exclusive: ['device', 'release'],
},
device: {
...cf.device,
...cf.device(),
exclusive: ['fleet', 'release'],
},
release: {

View File

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