Skip to content

Commit

Permalink
'meteor create': prose improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
gschmidt committed Apr 10, 2012
1 parent 486a63f commit 3dcfe65
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions app/meteor/meteor.js
Expand Up @@ -133,16 +133,19 @@ Commands.push({
func: function (argv) {
// reparse args
var opt = require('optimist')
.describe('example', 'Name of example application.')
.describe('example', 'Example template to use.')
.boolean('list')
.describe('list', 'Show list of available examples.')
.usage(
"Usage: meteor create <name>\n" +
" meteor create --example <example_name> [<name>]\n" +
" meteor create --list\n" +
"\n" +
"Make a subdirectory named <name> and create a new Meteor project\n" +
"there. You can also pass an absolute or relative path. Specify an\n" +
"example name to start with one of the example applications\n");
"there. You can also pass an absolute or relative path.\n" +
"\n" +
"You can pass --example to start off with a copy of one of the Meteor\n" +
"sample applications. Use --list to see the available examples.");

var new_argv = opt.argv;
var appname;
Expand All @@ -163,6 +166,8 @@ Commands.push({
_.each(examples, function (e) {
process.stdout.write(" " + e + "\n");
});
process.stdout.write("\n" +
"Create a project from an example with 'meteor create --example <name>'.\n")
process.exit(1);
};

Expand All @@ -188,13 +193,13 @@ Commands.push({

if (new_argv.example) {
if (examples.indexOf(new_argv.example) === -1) {
process.stderr.write("No such example application. Available examples include:\n");
_.each(examples, function (e) {
process.stdout.write(" " + e + "\n");
});
process.stderr.write(new_argv.example + ": no such example\n\n");
process.stderr.write("List available applications with 'meteor create --list'.\n");
process.exit(1);
} else {
files.cp_r(path.join(example_dir, new_argv.example), appname);
files.cp_r(path.join(example_dir, new_argv.example), appname, {
ignore: [/^local$/]
});
}
} else {
files.cp_r(path.join(__dirname, 'skel'), appname, {
Expand All @@ -206,9 +211,21 @@ Commands.push({
return new Buffer(transform(contents.toString()));
else
return contents;
}
},
ignore: [/^local$/]
});
}

process.stderr.write(appname + ": created");
if (new_argv.example &&
new_argv.example !== appname)
process.stderr.write(" (from '" + new_argv.example + "' template)");
process.stderr.write(".\n\n");

process.stderr.write(
"To run your new app:\n" +
" cd " + appname + "\n" +
" meteor\n");
}
});

Expand Down

0 comments on commit 3dcfe65

Please sign in to comment.