mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 17:33:18 +00:00
Merge branch 'master' of https://github.com/resin-io/resin-cli
This commit is contained in:
commit
56a78b57af
@ -114,13 +114,26 @@
|
||||
exports.associate = {
|
||||
signature: 'app associate <name>',
|
||||
description: 'associate a resin project',
|
||||
help: 'Use this command to associate a project directory with a resin application.\n\nThis command adds a \'resin\' git remote to the directory and runs git init if necessary.\n\nExamples:\n\n $ resin app associate MyApp\n $ resin app associate MyApp --project my/app/directory',
|
||||
help: 'Use this command to associate a project directory with a resin application.\n\nThis command adds a \'resin\' git remote to the directory and runs git init if necessary.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app associate MyApp\n $ resin app associate MyApp --project my/app/directory',
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var currentDirectory;
|
||||
currentDirectory = process.cwd();
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
return resin.models.application.has(params.name, callback);
|
||||
}, function(hasApp, callback) {
|
||||
var message;
|
||||
if (!hasApp) {
|
||||
return callback(new Error("Invalid application: " + params.name));
|
||||
}
|
||||
message = "Are you sure you want to associate " + currentDirectory + " with " + params.name + "?";
|
||||
return visuals.patterns.confirm(options.yes, message, callback);
|
||||
}, function(confirmed, callback) {
|
||||
if (!confirmed) {
|
||||
return done();
|
||||
}
|
||||
return vcs.initialize(currentDirectory, callback);
|
||||
}, function(callback) {
|
||||
return resin.models.application.get(params.name, callback);
|
||||
|
@ -177,6 +177,9 @@ Use this command to associate a project directory with a resin application.
|
||||
|
||||
This command adds a 'resin' git remote to the directory and runs git init if necessary.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app associate MyApp
|
||||
|
@ -151,11 +151,15 @@ exports.associate =
|
||||
|
||||
This command adds a 'resin' git remote to the directory and runs git init if necessary.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app associate MyApp
|
||||
$ resin app associate MyApp --project my/app/directory
|
||||
'''
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
currentDirectory = process.cwd()
|
||||
@ -163,6 +167,17 @@ exports.associate =
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
resin.models.application.has(params.name, callback)
|
||||
|
||||
(hasApp, callback) ->
|
||||
if not hasApp
|
||||
return callback(new Error("Invalid application: #{params.name}"))
|
||||
|
||||
message = "Are you sure you want to associate #{currentDirectory} with #{params.name}?"
|
||||
visuals.patterns.confirm(options.yes, message, callback)
|
||||
|
||||
(confirmed, callback) ->
|
||||
return done() if not confirmed
|
||||
vcs.initialize(currentDirectory, callback)
|
||||
|
||||
(callback) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user