File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ export class GenerateCommand extends SchematicCommand {
4848 const [ collectionName , schematicName ] = this . parseSchematicInfo ( options ) ;
4949
5050 // remove the schematic name from the options
51- // options._ = options._.slice(1);
5251 delete options . schematic ;
5352
5453 return this . runSchematic ( {
Original file line number Diff line number Diff line change @@ -63,18 +63,24 @@ export abstract class Command<T = any> {
6363 this . printHelpOptions ( this . options ) ;
6464 }
6565
66- private getArgIndex ( def : OptionSmartDefault | undefined ) : number {
67- if ( def === undefined || def . index === undefined || typeof def . index !== 'number' ) {
68- return 99999 ;
66+ private _getArguments ( options : Option [ ] ) {
67+ function _getArgIndex ( def : OptionSmartDefault | undefined ) : number {
68+ if ( def === undefined || def . $source !== 'argv' || typeof def . index !== 'number' ) {
69+ // If there's no proper order, this argument is wonky. We will show it at the end only
70+ // (after all other arguments).
71+ return Infinity ;
72+ }
73+
74+ return def . index ;
6975 }
7076
71- return def . index ;
77+ return options
78+ . filter ( opt => this . isArgument ( opt ) )
79+ . sort ( ( a , b ) => _getArgIndex ( a . $default ) - _getArgIndex ( b . $default ) ) ;
7280 }
7381
7482 protected printHelpUsage ( name : string , options : Option [ ] ) {
75- const args = options
76- . filter ( opt => this . isArgument ( opt ) )
77- . sort ( ( a , b ) => this . getArgIndex ( a . $default ) - this . getArgIndex ( b . $default ) ) ;
83+ const args = this . _getArguments ( options ) ;
7884 const opts = options . filter ( opt => ! this . isArgument ( opt ) ) ;
7985 const argDisplay = args && args . length > 0
8086 ? ' ' + args . map ( a => `<${ a . name } >` ) . join ( ' ' )
You can’t perform that action at this time.
0 commit comments