mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-07 11:26:41 +00:00
Renamed build arg option to —buildArg/-B
This commit is contained in:
parent
66876a2c85
commit
654ec75598
@ -36,10 +36,10 @@ exports.appendOptions = function(opts) {
|
||||
description: 'The alias to the generated image',
|
||||
alias: 't'
|
||||
}, {
|
||||
signature: 'arg',
|
||||
signature: 'buildArg',
|
||||
parameter: 'arg',
|
||||
description: 'Set a build-time variable (eg. "-e \'ARG=value\'"). Can be specified multiple times.',
|
||||
alias: 'e'
|
||||
description: 'Set a build-time variable (eg. "-B \'ARG=value\'"). Can be specified multiple times.',
|
||||
alias: 'B'
|
||||
}, {
|
||||
signature: 'nocache',
|
||||
description: "Don't use docker layer caching when building",
|
||||
@ -128,22 +128,22 @@ cacheHighlightStream = function() {
|
||||
};
|
||||
|
||||
parseBuildArgs = function(args, onError) {
|
||||
var _, obj;
|
||||
var _, buildArgs;
|
||||
_ = require('lodash');
|
||||
if (!_.isArray(args)) {
|
||||
args = [args];
|
||||
}
|
||||
obj = {};
|
||||
buildArgs = {};
|
||||
args.forEach(function(str) {
|
||||
var pair;
|
||||
pair = /^([^\s]+?)=(.*)$/.exec(str);
|
||||
if (pair != null) {
|
||||
return obj[pair[1]] = pair[2];
|
||||
return buildArgs[pair[1]] = pair[2];
|
||||
} else {
|
||||
return onError(str);
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
return buildArgs;
|
||||
};
|
||||
|
||||
exports.runBuild = function(params, options, getBundleInfo, logStreams) {
|
||||
@ -211,8 +211,8 @@ exports.runBuild = function(params, options, getBundleInfo, logStreams) {
|
||||
if (options.nocache != null) {
|
||||
opts['nocache'] = true;
|
||||
}
|
||||
if (options.arg != null) {
|
||||
opts['buildargs'] = parseBuildArgs(options.arg, function(arg) {
|
||||
if (options.buildArg != null) {
|
||||
opts['buildargs'] = parseBuildArgs(options.buildArg, function(arg) {
|
||||
return logging.logWarn(logStreams, "Could not parse variable: '" + arg + "'");
|
||||
});
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ exports.appendOptions = (opts) ->
|
||||
alias: 't'
|
||||
},
|
||||
{
|
||||
signature: 'arg'
|
||||
signature: 'buildArg'
|
||||
parameter: 'arg'
|
||||
description: 'Set a build-time variable (eg. "-e \'ARG=value\'"). Can be specified multiple times.'
|
||||
alias: 'e'
|
||||
description: 'Set a build-time variable (eg. "-B \'ARG=value\'"). Can be specified multiple times.'
|
||||
alias: 'B'
|
||||
},
|
||||
{
|
||||
signature: 'nocache'
|
||||
@ -138,14 +138,14 @@ parseBuildArgs = (args, onError) ->
|
||||
_ = require('lodash')
|
||||
if not _.isArray(args)
|
||||
args = [ args ]
|
||||
obj = {}
|
||||
buildArgs = {}
|
||||
args.forEach (str) ->
|
||||
pair = /^([^\s]+?)=(.*)$/.exec(str)
|
||||
if pair?
|
||||
obj[pair[1]] = pair[2]
|
||||
buildArgs[pair[1]] = pair[2]
|
||||
else
|
||||
onError(str)
|
||||
return obj
|
||||
return buildArgs
|
||||
|
||||
# Pass in the command line parameters and options and also
|
||||
# a function which will return the information about the bundle
|
||||
@ -225,8 +225,8 @@ exports.runBuild = (params, options, getBundleInfo, logStreams) ->
|
||||
opts['t'] = options.tag
|
||||
if options.nocache?
|
||||
opts['nocache'] = true
|
||||
if options.arg?
|
||||
opts['buildargs'] = parseBuildArgs options.arg, (arg) ->
|
||||
if options.buildArg?
|
||||
opts['buildargs'] = parseBuildArgs options.buildArg, (arg) ->
|
||||
logging.logWarn(logStreams, "Could not parse variable: '#{arg}'")
|
||||
|
||||
builder.createBuildStream(opts, hooks, reject)
|
||||
|
Loading…
x
Reference in New Issue
Block a user