Skip to content

Commit ef8f0ae

Browse files
committed
feat(help): add -h help command with proper output
- Added not yet implemented to each workflow
1 parent 383f130 commit ef8f0ae

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-5
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ insert_final_newline = true
1111
# 2 space indentation
1212
[**.*]
1313
indent_style = space
14-
indent_size = 2
14+
indent_size = 2

bin/aurelia.js

100644100755
-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
2-
32
const Liftoff = require('liftoff');
43
const argv = require('minimist')(process.argv.slice(2));
54

index.js

+63-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var program = require('commander');
22
var bundler = require('./lib/bundler');
3+
var pjson = require('./package.json');
4+
var chalk = require('chalk');
35

46
function Aurelia(env) {
57
this.env = env;
@@ -17,12 +19,27 @@ Aurelia.prototype.run = function(argv) {
1719
var self = this;
1820

1921
program
20-
.version('0.0.1');
22+
.version(pjson.version)
23+
.on('--help', function () {
24+
console.log('\n'
25+
+ ' ' + chalk.bgMagenta(' ') + chalk.bgRed(' ') + chalk.bgMagenta(' ') + '\n'
26+
+ ' ' + chalk.bgRed.black(' aurelia ') + '\n'
27+
+ ' ' + chalk.bgMagenta(' ') + chalk.bgRed(' ') + chalk.bgMagenta(' ') + '\n'
28+
);
29+
});
2130

2231
program
23-
.command('bundle')
24-
.description('bundles js modules and templates')
32+
.command('bundle <bundle_name>')
33+
.alias('b')
34+
.description('Create a new bundle or enable already created bundle')
35+
.option('-a --add <path>', "Add system.js path to files or file to bundle")
36+
.option('-r --remove <remove_path>', 'Remove file path or file from bundle')
37+
.option('-l, --list', 'List paths and files included in bundle')
2538
.action(function(options) {
39+
console.log('Bundle running without modifiers...')
40+
console.log('-----------------------------------')
41+
console.log(' - Managing bundles not yet implemented')
42+
console.log(' | - (-a, -r, -l)')
2643
bundler.bundleJS(self.bundleConfig.js);
2744
});
2845

@@ -33,8 +50,51 @@ Aurelia.prototype.run = function(argv) {
3350
bundler.bundleTemplate(self.bundleConfig.template, self.config);
3451
});
3552

53+
program
54+
.command('generate <type>')
55+
.alias('g')
56+
.description('Generate new file type based on type specified')
57+
.option('-n, --name <name>', "Name of the file / class")
58+
.option('-v, --view', "Create a view for generated file type")
59+
.option('-i, --inject <name>', "Name of dependency to inject")
60+
.option('--no-lifecycle', "Do not create lifecycle callbacks, if applicable")
61+
.option('-t, --template <name>', "Specify the name of the template to use as override")
62+
.action(function(cmd, options) {
63+
console.log('exec "%s" using %s mode', cmd, options.name);
64+
console.log('Not yet implemented...');
65+
console.log('-----------------------------------')
66+
console.log(' - Generating not yet implemented')
67+
}).on('--help', function () {
68+
console.log(' Examples:');
69+
console.log();
70+
console.log(' $ aurelia g viewmodel');
71+
console.log(' $ aurelia g viewmodel -v -n app.html -i bindable');
72+
console.log();
73+
});
74+
75+
program
76+
.command('plugin <plugin_name>')
77+
.alias('p')
78+
.description('List all installed plugins')
79+
.option('-a, --add <name>', "Add plugin from Aurelia plugin repo")
80+
.option('-r, --remove <name>', "Disable plugin from project")
81+
.option('-c, --clear', "Completely remove plugin and files")
82+
.action(function(cmd, options) {
83+
console.log('exec "%s" using %s mode', cmd, options.name);
84+
console.log('Not yet implemented...')
85+
console.log('-----------------------------------')
86+
console.log(' - Plugin management not yet implemented')
87+
}).on('--help', function () {
88+
console.log(' Examples:');
89+
console.log();
90+
console.log(' $ aurelia plugin -a i18n');
91+
console.log(' $ aurelia p -r i18n -c');
92+
console.log();
93+
});
94+
3695
program
3796
.command('new')
97+
.description('create a new Aurelia project')
3898
.action(function(options) {
3999
console.log('set a new aurelia project');
40100
});

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"url": "https://github.com/aurelia/cli"
2424
},
2525
"dependencies": {
26+
"chalk": "^1.0.0",
2627
"commander": "^2.7.1",
2728
"glob": "^5.0.3",
2829
"interpret": "^0.5.2",

0 commit comments

Comments
 (0)