Permalink
Browse files

The "create" task now accepts name as either argument or option. Twea…

…ked the the wording on a couple of error messages.
  • Loading branch information...
1 parent 2762ac3 commit 46e9379f0a04091be70682cbfbc9c3ec4459cffe @thatismatt committed Jun 7, 2010
Showing with 6 additions and 6 deletions.
  1. +1 −1 bin/josi
  2. +5 −5 lib/josi/tasks/create.js
View
@@ -29,7 +29,7 @@ var matchingTasks = task ? tasks.getAllMatching(task) : [];
if (matchingTasks.length == 1) {
var matchedTask = matchingTasks[0];
if (!utilities.cwdContainsApp() && matchedTask.appOnly) {
- sys.puts('ERROR: can only execute the task "' + matchedTask.name + '" in a directory containing a josi app.');
+ sys.puts('ERROR: The task "' + matchedTask.name + '" can only be executed in a directory containing a josi app.');
} else {
matchedTask.execute(opts, args, tasks.tasks);
}
View
@@ -5,15 +5,15 @@ var utilities = require('josi/utilities');
this.task = {
name: 'create',
- doc: 'create a new josi app',
- execute: function(opts) {
- if (!opts.name) {
+ doc: 'create a new josi app or parts of an existing josi app',
+ execute: function(opts, args) {
+ var appName = opts.name || args[0];
+ if (!appName) {
sys.puts('ERROR: When creating a josi app you must specify its name.');
return;
}
- var appName = opts.name;
if (utilities.fileOrDirectoryExists(appName)) {
- sys.puts('Can\'t create a new josi app with the name "' + appName + '",' +
+ sys.puts('ERROR: Can\'t create a josi app named "' + appName + '",' +
' as a file or directory with that name already exists.');
return;
}

0 comments on commit 46e9379

Please sign in to comment.