@@ -7,8 +7,8 @@ const stringUtils = require('ember-cli-string-utils');
7
7
const Command = require ( '../ember-cli/lib/models/command' ) ;
8
8
const lookupCommand = require ( '../ember-cli/lib/cli/lookup-command' ) ;
9
9
10
- function extractOptions ( opts : any ) : String {
11
- const output : String [ ] = [ ] ;
10
+ function extractOptions ( opts : any ) : string {
11
+ const output : string [ ] = [ ] ;
12
12
13
13
for ( let index = 0 ; index < opts . length ; index ++ ) {
14
14
const element = opts [ index ] ;
@@ -21,20 +21,30 @@ function extractOptions(opts: any): String {
21
21
return output . sort ( ) . join ( ' ' ) ;
22
22
}
23
23
24
+ function extractBlueprints ( opts : any ) : string {
25
+ const output : string [ ] = [ ] ;
26
+
27
+ for ( let index = 0 ; index < opts . length ; index ++ ) {
28
+ const element = opts [ index ] ;
29
+ output . push ( element . name ) ;
30
+ }
31
+
32
+ return output . sort ( ) . join ( ' ' ) ;
33
+ }
34
+
24
35
export interface CompletionCommandOptions {
25
36
all ?: boolean ;
26
37
bash ?: boolean ;
27
38
zsh ?: boolean ;
28
39
} ;
29
40
30
41
const commandsToIgnore = [
31
- 'easter-egg' ,
32
- 'init' ,
33
42
'destroy' ,
34
- 'github-pages-deploy' // errors because there is no base github-pages command
43
+ 'easter-egg' ,
44
+ 'init'
35
45
] ;
36
46
37
- const optsNg : String [ ] = [ ] ;
47
+ const optsNg : string [ ] = [ ] ;
38
48
39
49
const CompletionCommand = Command . extend ( {
40
50
name : 'completion' ,
@@ -70,7 +80,7 @@ const CompletionCommand = Command.extend({
70
80
71
81
commandFiles . forEach ( cmd => {
72
82
const Command = lookupCommand ( commandMap , cmd ) ;
73
- const com : String [ ] = [ ] ;
83
+ const com : string [ ] = [ ] ;
74
84
75
85
const command = new Command ( {
76
86
ui : this . ui ,
@@ -83,21 +93,26 @@ const CompletionCommand = Command.extend({
83
93
com . push ( command . name ) ;
84
94
85
95
if ( command . aliases ) {
86
- command . aliases . forEach ( ( element : String ) => {
96
+ command . aliases . forEach ( ( element : string ) => {
87
97
optsNg . push ( element ) ;
88
98
com . push ( element ) ;
89
99
} ) ;
90
100
}
91
101
102
+ let opts = '' ;
103
+ if ( command . blueprints && command . blueprints [ 0 ] ) {
104
+ opts += extractBlueprints ( command . blueprints ) ;
105
+ }
106
+
92
107
if ( command . availableOptions && command . availableOptions [ 0 ] ) {
93
- let opts = extractOptions ( command . availableOptions ) ;
108
+ opts + = extractOptions ( command . availableOptions ) ;
94
109
caseBlock = caseBlock + ' ' + com . sort ( ) . join ( '|' ) + ') opts="' + opts + '" ;;\n' ;
95
110
}
96
111
} ) ;
97
112
98
113
caseBlock = 'ng|help) opts="' + optsNg . sort ( ) . join ( ' ' ) + '" ;;\n' +
99
- caseBlock +
100
- ' *) opts="" ;;' ;
114
+ caseBlock +
115
+ ' *) opts="" ;;' ;
101
116
102
117
console . log ( stripIndent `
103
118
###-begin-ng-completion###
0 commit comments