@@ -33,6 +33,7 @@ export default abstract class Command {
33
33
static args : args . IArg [ ] = [ ]
34
34
static plugin : Config . IPlugin | undefined
35
35
static examples : string [ ] | undefined
36
+ static parse : boolean = true
36
37
37
38
/**
38
39
* instantiate and run the command
@@ -56,9 +57,9 @@ export default abstract class Command {
56
57
return convertToCached ( this , opts )
57
58
}
58
59
59
- argv : string [ ]
60
- flags : flags . Output
61
- args : args . Output
60
+ argv ! : string [ ]
61
+ flags ! : flags . Output
62
+ args ! : args . Output
62
63
63
64
// prevent setting things that need to be static
64
65
description ! : null
@@ -77,6 +78,13 @@ export default abstract class Command {
77
78
this . debug = require ( 'debug' ) ( this . ctor . id ? `${ config . bin } :${ this . ctor . id } ` : config . bin )
78
79
this . debug ( 'init version: %s argv: %o' , this . ctor . _base , argv )
79
80
cli . config . context . command = _ . compact ( [ this . ctor . id , ...argv ] ) . join ( ' ' )
81
+ cli . config . context . version = config . userAgent
82
+ if ( config . debug ) cli . config . debug = true
83
+ cli . config . errlog = config . errlog
84
+ if ( ! this . ctor . parse ) {
85
+ this . argv = argv . slice ( 1 )
86
+ return
87
+ }
80
88
try {
81
89
const parse = deps . Parser . parse ( {
82
90
argv,
@@ -93,9 +101,6 @@ export default abstract class Command {
93
101
}
94
102
throw err
95
103
}
96
- cli . config . context . version = config . userAgent
97
- if ( config . debug ) cli . config . debug = true
98
- cli . config . errlog = config . errlog
99
104
}
100
105
101
106
get ctor ( ) : typeof Command {
0 commit comments