mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 09:51:58 +00:00
Switch to native Array.isArray
instead of aliases
Change-type: patch
This commit is contained in:
parent
18d3ca3413
commit
f859d5025a
@ -36,7 +36,7 @@ export function getOptionSignature(signature: string) {
|
|||||||
export function parseCapitanoOption(option: OptionDefinition): string {
|
export function parseCapitanoOption(option: OptionDefinition): string {
|
||||||
let result = getOptionSignature(option.signature);
|
let result = getOptionSignature(option.signature);
|
||||||
|
|
||||||
if (_.isArray(option.alias)) {
|
if (Array.isArray(option.alias)) {
|
||||||
for (const alias of option.alias) {
|
for (const alias of option.alias) {
|
||||||
result += `, ${getOptionSignature(alias)}`;
|
result += `, ${getOptionSignature(alias)}`;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,6 @@ export const logs: CommandDefinition<
|
|||||||
async action(params, options, done) {
|
async action(params, options, done) {
|
||||||
normalizeUuidProp(params);
|
normalizeUuidProp(params);
|
||||||
const balena = getBalenaSdk();
|
const balena = getBalenaSdk();
|
||||||
const isArray = await import('lodash/isArray');
|
|
||||||
const { serviceIdToName } = await import('../utils/cloud');
|
const { serviceIdToName } = await import('../utils/cloud');
|
||||||
const { displayDeviceLogs, displayLogObject } = await import(
|
const { displayDeviceLogs, displayLogObject } = await import(
|
||||||
'../utils/device/logs'
|
'../utils/device/logs'
|
||||||
@ -101,7 +100,7 @@ export const logs: CommandDefinition<
|
|||||||
|
|
||||||
const servicesToDisplay =
|
const servicesToDisplay =
|
||||||
options.service != null
|
options.service != null
|
||||||
? isArray(options.service)
|
? Array.isArray(options.service)
|
||||||
? options.service
|
? options.service
|
||||||
: [options.service]
|
: [options.service]
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -249,7 +249,7 @@ module.exports =
|
|||||||
options.pinDevice = options['pin-device-to-release'] || false
|
options.pinDevice = options['pin-device-to-release'] || false
|
||||||
delete options['pin-device-to-release']
|
delete options['pin-device-to-release']
|
||||||
|
|
||||||
if _.isArray(options['add-certificate'])
|
if Array.isArray(options['add-certificate'])
|
||||||
certificates = options['add-certificate']
|
certificates = options['add-certificate']
|
||||||
else if options['add-certificate'] == undefined
|
else if options['add-certificate'] == undefined
|
||||||
certificates = []
|
certificates = []
|
||||||
|
@ -263,7 +263,6 @@ export const push: CommandDefinition<
|
|||||||
async action(params, options) {
|
async action(params, options) {
|
||||||
const sdk = getBalenaSdk();
|
const sdk = getBalenaSdk();
|
||||||
const Bluebird = await import('bluebird');
|
const Bluebird = await import('bluebird');
|
||||||
const isArray = await import('lodash/isArray');
|
|
||||||
const remote = await import('../utils/remote-build');
|
const remote = await import('../utils/remote-build');
|
||||||
const deviceDeploy = await import('../utils/device/deploy');
|
const deviceDeploy = await import('../utils/device/deploy');
|
||||||
const { checkLoggedIn } = await import('../utils/patterns');
|
const { checkLoggedIn } = await import('../utils/patterns');
|
||||||
@ -348,7 +347,7 @@ export const push: CommandDefinition<
|
|||||||
const device = appOrDevice;
|
const device = appOrDevice;
|
||||||
const servicesToDisplay =
|
const servicesToDisplay =
|
||||||
options.service != null
|
options.service != null
|
||||||
? isArray(options.service)
|
? Array.isArray(options.service)
|
||||||
? options.service
|
? options.service
|
||||||
: [options.service]
|
: [options.service]
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -18,7 +18,6 @@ import { CommandDefinition } from 'capitano';
|
|||||||
import { stripIndent } from 'common-tags';
|
import { stripIndent } from 'common-tags';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { createServer, Server, Socket } from 'net';
|
import { createServer, Server, Socket } from 'net';
|
||||||
import { isArray } from 'util';
|
|
||||||
|
|
||||||
import { getBalenaSdk } from '../utils/lazy';
|
import { getBalenaSdk } from '../utils/lazy';
|
||||||
import { getOnlineTargetUuid } from '../utils/patterns';
|
import { getOnlineTargetUuid } from '../utils/patterns';
|
||||||
@ -121,7 +120,7 @@ export const tunnel: CommandDefinition<Args, Options> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ports =
|
const ports =
|
||||||
typeof options.port !== 'string' && isArray(options.port)
|
typeof options.port !== 'string' && Array.isArray(options.port)
|
||||||
? (options.port as string[])
|
? (options.port as string[])
|
||||||
: [options.port as string];
|
: [options.port as string];
|
||||||
|
|
||||||
|
@ -376,9 +376,7 @@ getPreviousRepos = (sdk, docker, logger, appID) ->
|
|||||||
logger.logDebug("Failed to access previously pushed image repo: #{e}")
|
logger.logDebug("Failed to access previously pushed image repo: #{e}")
|
||||||
|
|
||||||
authorizePush = (sdk, logger, tokenAuthEndpoint, registry, images, previousRepos) ->
|
authorizePush = (sdk, logger, tokenAuthEndpoint, registry, images, previousRepos) ->
|
||||||
_ = require('lodash')
|
if not Array.isArray(images)
|
||||||
|
|
||||||
if not _.isArray(images)
|
|
||||||
images = [ images ]
|
images = [ images ]
|
||||||
|
|
||||||
images.push previousRepos...
|
images.push previousRepos...
|
||||||
|
@ -148,8 +148,7 @@ generateConnectOpts = (opts) ->
|
|||||||
return connectOpts
|
return connectOpts
|
||||||
|
|
||||||
parseBuildArgs = (args) ->
|
parseBuildArgs = (args) ->
|
||||||
_ = require('lodash')
|
if not Array.isArray(args)
|
||||||
if not _.isArray(args)
|
|
||||||
args = [ args ]
|
args = [ args ]
|
||||||
buildArgs = {}
|
buildArgs = {}
|
||||||
args.forEach (arg) ->
|
args.forEach (arg) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user