1
1
var program = require ( 'commander' ) ;
2
2
var bundler = require ( './lib/bundler' ) ;
3
+ var pjson = require ( './package.json' ) ;
4
+ var chalk = require ( 'chalk' ) ;
3
5
4
6
function Aurelia ( env ) {
5
7
this . env = env ;
@@ -17,12 +19,27 @@ Aurelia.prototype.run = function(argv) {
17
19
var self = this ;
18
20
19
21
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
+ } ) ;
21
30
22
31
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' )
25
38
. 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)' )
26
43
bundler . bundleJS ( self . bundleConfig . js ) ;
27
44
} ) ;
28
45
@@ -33,8 +50,51 @@ Aurelia.prototype.run = function(argv) {
33
50
bundler . bundleTemplate ( self . bundleConfig . template , self . config ) ;
34
51
} ) ;
35
52
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
+
36
95
program
37
96
. command ( 'new' )
97
+ . description ( 'create a new Aurelia project' )
38
98
. action ( function ( options ) {
39
99
console . log ( 'set a new aurelia project' ) ;
40
100
} ) ;
0 commit comments