This repository was archived by the owner on Aug 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,43 @@ class BaseCommand extends Command {
65
65
}
66
66
}
67
67
68
+ parse ( opts , argv = this . argv ) {
69
+ /* enrich parse with global flags */
70
+ const globalFlags = { }
71
+ if ( opts . flags && ! opts . flags . silent ) {
72
+ globalFlags [ 'silent' ] = {
73
+ parse : ( b , _ ) => b ,
74
+ description : 'Silence CLI output' ,
75
+ allowNo : false ,
76
+ type : 'boolean'
77
+ }
78
+ }
79
+ if ( opts . flags && ! opts . flags . json ) {
80
+ globalFlags [ 'json' ] = {
81
+ parse : ( b , _ ) => b ,
82
+ description : 'Output return values as JSON' ,
83
+ allowNo : false ,
84
+ type : 'boolean'
85
+ }
86
+ }
87
+ if ( opts . flags && ! opts . flags . auth ) {
88
+ globalFlags [ 'auth' ] = {
89
+ parse : ( b , _ ) => b ,
90
+ description : 'Netlify auth token' ,
91
+ input : [ ] ,
92
+ multiple : false ,
93
+ type : 'option'
94
+ }
95
+ }
96
+
97
+ // enrich with flags here
98
+ opts . flags = Object . assign ( { } , opts . flags , globalFlags )
99
+
100
+ return require ( '@oclif/parser' ) . parse ( argv , Object . assign ( { } , {
101
+ context : this ,
102
+ } , opts ) )
103
+ }
104
+
68
105
/**
69
106
* Get user netlify API token
70
107
* @param {string } - [tokenFromFlag] - value passed in by CLI flag
You can’t perform that action at this time.
0 commit comments