diff --git a/docs/balena-cli.md b/docs/balena-cli.md index 4c897a7e..47241812 100644 --- a/docs/balena-cli.md +++ b/docs/balena-cli.md @@ -1454,6 +1454,7 @@ Examples: $ balena device os-update 23c73a1 $ balena device os-update 23c73a1 --version 2.101.7 $ balena device os-update 23c73a1 --version 2.31.0+rev1.prod + $ balena device os-update 23c73a1 --include-draft ### Arguments @@ -1467,6 +1468,10 @@ the uuid of the device to update a balenaOS version +#### --include-draft + +include pre-release balenaOS versions + #### -y, --yes answer "yes" to all questions (non interactive use) diff --git a/lib/commands/device/os-update.ts b/lib/commands/device/os-update.ts index 7501a08b..bb5b3226 100644 --- a/lib/commands/device/os-update.ts +++ b/lib/commands/device/os-update.ts @@ -37,6 +37,7 @@ export default class DeviceOsUpdateCmd extends Command { '$ balena device os-update 23c73a1', '$ balena device os-update 23c73a1 --version 2.101.7', '$ balena device os-update 23c73a1 --version 2.31.0+rev1.prod', + '$ balena device os-update 23c73a1 --include-draft', ]; public static args = { @@ -51,6 +52,12 @@ export default class DeviceOsUpdateCmd extends Command { public static flags = { version: Flags.string({ description: 'a balenaOS version', + exclusive: ['include-draft'], + }), + 'include-draft': Flags.boolean({ + description: 'include pre-release balenaOS versions', + default: false, + exclusive: ['version'], }), yes: cf.yes, help: cf.help, @@ -86,8 +93,8 @@ export default class DeviceOsUpdateCmd extends Command { ); } - let includeDraft = false; - if (options.version != null) { + let includeDraft = options['include-draft']; + if (!includeDraft && options.version != null) { const bSemver = await import('balena-semver'); const parsedVersion = bSemver.parse(options.version); // When the user provides a draft version, we need to pass `includeDraft`