diff --git a/doc/cli.markdown b/doc/cli.markdown index 5f5c8bf1..42af50da 100644 --- a/doc/cli.markdown +++ b/doc/cli.markdown @@ -861,9 +861,9 @@ By default, the command prints all log messages and exits. To continuously stream output, and see new logs in real time, use the `--tail` option. -If an IP address is passed to this command, logs are displayed from +If an IP or .local address is passed to this command, logs are displayed from a local mode device with that address. Note that --tail is implied -when this command is provided an IP address. +when this command is provided a local mode device. Logs from a single service can be displayed with the --service flag. Just system logs can be shown with the --system flag. Note that these flags can be used together. @@ -872,12 +872,12 @@ Examples: $ balena logs 23c73a1 $ balena logs 23c73a1 --tail - $ balena logs 23c73a1 --service my-service $ balena logs 192.168.0.31 $ balena logs 192.168.0.31 --service my-service - $ balena logs 192.168.0.31 --system - $ balena logs 192.168.0.31 --system --service my-service + + $ balena logs 23c73a1.local --system + $ balena logs 23c73a1.local --system --service my-service ### Options @@ -1454,10 +1454,10 @@ Examples: $ balena push 10.0.0.1 $ balena push 10.0.0.1 --source - $ balena push 10.0.0.1 -s $ balena push 10.0.0.1 --service my-service - $ balena push 10.0.0.1 --system - $ balena push 10.0.0.1 --system --service my-service + + $ balena push 23c73a1.local --system + $ balena push 23c73a1.local --system --service my-service ### Options diff --git a/lib/actions/logs.ts b/lib/actions/logs.ts index acd5dddc..f553a189 100644 --- a/lib/actions/logs.ts +++ b/lib/actions/logs.ts @@ -18,6 +18,7 @@ import { CommandDefinition } from 'capitano'; import { stripIndent } from 'common-tags'; import { normalizeUuidProp } from '../utils/normalization'; +import { validateDotLocalUrl } from '../utils/validation'; type CloudLog = | { @@ -51,9 +52,9 @@ export const logs: CommandDefinition< To continuously stream output, and see new logs in real time, use the \`--tail\` option. - If an IP address is passed to this command, logs are displayed from + If an IP or .local address is passed to this command, logs are displayed from a local mode device with that address. Note that --tail is implied - when this command is provided an IP address. + when this command is provided a local mode device. Logs from a single service can be displayed with the --service flag. Just system logs can be shown with the --system flag. Note that these flags can be used together. @@ -62,12 +63,12 @@ export const logs: CommandDefinition< $ balena logs 23c73a1 $ balena logs 23c73a1 --tail - $ balena logs 23c73a1 --service my-service $ balena logs 192.168.0.31 $ balena logs 192.168.0.31 --service my-service - $ balena logs 192.168.0.31 --system - $ balena logs 192.168.0.31 --system --service my-service`, + + $ balena logs 23c73a1.local --system + $ balena logs 23c73a1.local --system --service my-service`, options: [ { signature: 'tail', @@ -127,7 +128,10 @@ export const logs: CommandDefinition< } }; - if (validateIPAddress(params.uuidOrDevice)) { + if ( + validateIPAddress(params.uuidOrDevice) || + validateDotLocalUrl(params.uuidOrDevice) + ) { const { DeviceAPI } = await import('../utils/device/api'); const deviceApi = new DeviceAPI(logger, params.uuidOrDevice); logger.logDebug('Checking we can access device'); diff --git a/lib/actions/push.ts b/lib/actions/push.ts index cf81d563..4382acf2 100644 --- a/lib/actions/push.ts +++ b/lib/actions/push.ts @@ -21,6 +21,7 @@ import { stripIndent } from 'common-tags'; import { registrySecretsHelp } from '../utils/messages'; import { validateApplicationName, + validateDotLocalUrl, validateIPAddress, } from '../utils/validation'; @@ -35,7 +36,7 @@ function getBuildTarget(appOrDevice: string): BuildTarget | null { return BuildTarget.Cloud; } - if (validateIPAddress(appOrDevice)) { + if (validateIPAddress(appOrDevice) || validateDotLocalUrl(appOrDevice)) { return BuildTarget.Device; } @@ -148,10 +149,10 @@ export const push: CommandDefinition< $ balena push 10.0.0.1 $ balena push 10.0.0.1 --source - $ balena push 10.0.0.1 -s $ balena push 10.0.0.1 --service my-service - $ balena push 10.0.0.1 --system - $ balena push 10.0.0.1 --system --service my-service + + $ balena push 23c73a1.local --system + $ balena push 23c73a1.local --system --service my-service `, options: [ {