diff --git a/completion/_balena b/completion/_balena index 2a9af301..21ee47b2 100644 --- a/completion/_balena +++ b/completion/_balena @@ -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 ) diff --git a/completion/balena-completion.bash b/completion/balena-completion.bash index 5efbf741..78c9c32f 100644 --- a/completion/balena-completion.bash +++ b/completion/balena-completion.bash @@ -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" diff --git a/docs/balena-cli.md b/docs/balena-cli.md index d7b3236b..de2a8d55 100644 --- a/docs/balena-cli.md +++ b/docs/balena-cli.md @@ -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 ` 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 ` 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 diff --git a/src/commands/device/note.ts b/src/commands/device/note.ts index d27654ca..5be144c8 100644 --- a/src/commands/device/note.ts +++ b/src/commands/device/note.ts @@ -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'); diff --git a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt index 841aaa04..417366c2 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-darwin-x64.txt b/tests/test-data/pkg/expected-warnings-darwin-x64.txt index 33a73f3d..4495b433 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-x64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-x64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-linux-arm64.txt b/tests/test-data/pkg/expected-warnings-linux-arm64.txt index 841aaa04..417366c2 100644 --- a/tests/test-data/pkg/expected-warnings-linux-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-arm64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-linux-x64.txt b/tests/test-data/pkg/expected-warnings-linux-x64.txt index 33a73f3d..4495b433 100644 --- a/tests/test-data/pkg/expected-warnings-linux-x64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-x64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-win32-x64.txt b/tests/test-data/pkg/expected-warnings-win32-x64.txt index 3a106749..b0a258a3 100644 --- a/tests/test-data/pkg/expected-warnings-win32-x64.txt +++ b/tests/test-data/pkg/expected-warnings-win32-x64.txt @@ -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