Add alias device note for command notes

Change-type: minor
This commit is contained in:
myarmolinsky 2024-09-26 12:45:48 -04:00
parent 8ee5ede34d
commit 3eb3b3b584
9 changed files with 63 additions and 59 deletions

View File

@ -8,13 +8,13 @@ _balena() {
local context state line curcontext="$curcontext"
# Valid top-level completions
main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout notes organization os preload push release settings ssh-key support tag util version whoami )
main_commands=( api-key app block build config deploy device devices env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami )
# Sub-completions
api_key_cmds=( generate list revoke )
app_cmds=( create )
block_cmds=( create )
config_cmds=( generate inject read reconfigure write )
device_cmds=( deactivate detect identify init list local-mode logs move os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel )
device_cmds=( deactivate detect identify init list local-mode logs move note os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel )
devices_cmds=( supported )
env_cmds=( list rename rm set )
fleet_cmds=( create list pin purge rename restart rm track-latest )

View File

@ -7,13 +7,13 @@ _balena_complete()
local cur prev
# Valid top-level completions
main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout notes organization os preload push release settings ssh-key support tag util version whoami"
main_commands="api-key app block build config deploy device devices env fleet internal join leave local login logout organization os preload push release settings ssh-key support tag util version whoami"
# Sub-completions
api_key_cmds="generate list revoke"
app_cmds="create"
block_cmds="create"
config_cmds="generate inject read reconfigure write"
device_cmds="deactivate detect identify init list local-mode logs move os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel"
device_cmds="deactivate detect identify init list local-mode logs move note os-update pin public-url purge reboot register rename restart rm shutdown ssh start-service stop-service track-fleet tunnel"
devices_cmds="supported"
env_cmds="list rename rm set"
fleet_cmds="create list pin purge rename restart rm track-latest"

View File

@ -204,6 +204,7 @@ are encouraged to regularly update the balena CLI to the latest version.
- [device local-mode](#device-local-mode)
- [device logs](#device-logs)
- [device move](#device-move)
- [device note](#device-note)
- [device os-update](#device-os-update)
- [device pin](#device-pin)
- [device public-url](#device-public-url)
@ -245,10 +246,6 @@ are encouraged to regularly update the balena CLI to the latest version.
- [local configure](#local-configure)
- [local flash](#local-flash)
- Notes
- [notes](#notes)
- Organizations
- [organization list](#organization-list)
@ -1610,6 +1607,43 @@ comma-separated list (no blank spaces) of device UUIDs to be moved
fleet name or slug (preferred)
## device note
### Aliases
- `notes`
To use one of the aliases, replace `device note` with the alias.
### Description
Set or update a device note. If the note argument is not provided,
it will be read from stdin.
To view device notes, use the `balena device <uuid>` command.
Examples:
$ balena device note "My useful note" --device 7cf02a6
$ cat note.txt | balena device note --device 7cf02a6
### Arguments
#### NOTE
note content
### Options
#### -d, --device DEVICE
device UUID
#### --dev DEV
## device os-update
### Description
@ -2771,38 +2805,6 @@ Check `balena util available-drives` for available options.
answer "yes" to all questions (non interactive use)
# Notes
## notes
### Description
Set or update a device note. If the note argument is not provided,
it will be read from stdin.
To view device notes, use the `balena device <uuid>` command.
Examples:
$ balena note "My useful note" --device 7cf02a6
$ cat note.txt | balena note --device 7cf02a6
### Arguments
#### NOTE
note content
### Options
#### -d, --device DEVICE
device UUID
#### --dev DEV
# Organizations
## organization list

View File

@ -20,7 +20,9 @@ import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
export default class NoteCmd extends Command {
export default class DeviceNoteCmd extends Command {
public static aliases = ['notes'];
public static description = stripIndent`
Set a device note.
@ -31,8 +33,8 @@ export default class NoteCmd extends Command {
`;
public static examples = [
'$ balena note "My useful note" --device 7cf02a6',
'$ cat note.txt | balena note --device 7cf02a6',
'$ balena device note "My useful note" --device 7cf02a6',
'$ cat note.txt | balena device note --device 7cf02a6',
];
public static args = {
@ -53,7 +55,7 @@ export default class NoteCmd extends Command {
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(NoteCmd);
const { args: params, flags: options } = await this.parse(DeviceNoteCmd);
if (params.note?.length === 0) {
throw new ExpectedError('Missing note content');

View File

@ -91,6 +91,9 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/move.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/note.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/os-update.js
@ -199,9 +202,6 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/logout/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/notes/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/organization/list.js

View File

@ -91,6 +91,9 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/move.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/note.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/os-update.js
@ -199,9 +202,6 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/logout/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/notes/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/organization/list.js

View File

@ -91,6 +91,9 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/move.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/note.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/os-update.js
@ -199,9 +202,6 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/logout/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/notes/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/organization/list.js

View File

@ -91,6 +91,9 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/move.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/note.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/device/os-update.js
@ -199,9 +202,6 @@
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/logout/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/notes/index.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/organization/list.js

View File

@ -91,6 +91,9 @@
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\device\move.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\device\note.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\device\os-update.js
@ -199,9 +202,6 @@
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\logout\index.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\notes\index.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\organization\list.js