Skip to content

Commit

Permalink
[api][doc] updated jitsu.comands.env.load function to utilize optiona…
Browse files Browse the repository at this point in the history
…l appname and filename in that order\n also updated self documenting feature to reflect this
  • Loading branch information
blakmatrix committed Dec 11, 2012
1 parent 5aecfdc commit 2b1ccf9
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions lib/jitsu/commands/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,13 @@ env.load = function (appName, file, callback) {
if(arguments.length) {
var args = utile.args(arguments);
callback = args.callback;
file = args[0] || 'env.json';
appName = args[1] || null;
appName = args[0] || null;
file = args[1] || 'env.json';
if (appName === null){
viewApp(callback, executeLoad);
} else{
viewAppByName(appName, function(){jitsu.commands.env.load(null, appName, callback);}, executeLoad);
}
}

function executeLoad(err, app) {
Expand All @@ -345,7 +350,7 @@ env.load = function (appName, file, callback) {
env = JSON.parse(data);
}
catch (err) {
jitsu.log.error('Error parsing ' + file);
jitsu.log.error('Error parsing ' + file.yellow);
return callback(err);
}

Expand All @@ -371,13 +376,6 @@ env.load = function (appName, file, callback) {
});
});
}

if (!appName) {
viewApp(callback, executeLoad);
}
else {
viewAppByName(appName, callback, executeLoad);
}
};

//
Expand All @@ -389,8 +387,9 @@ env.load.usage = [
'for use with `jitsu env save`. See `jitsu help env save` for more info.',
'',
'jitsu env load',
'jitsu env load <file>',
'jitsu env load <file> <app>',
'jitsu env load [<app>]',
'jitsu env load [<file>]',
'jitsu env load [<app>] [<file>]',
];

//
Expand Down

0 comments on commit 2b1ccf9

Please sign in to comment.