File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export default abstract class Command {
90
90
91
91
static parserOptions = { }
92
92
93
- static disableJsonFlag : boolean | undefined
93
+ static enableJsonFlag = false
94
94
95
95
// eslint-disable-next-line valid-jsdoc
96
96
/**
@@ -127,7 +127,7 @@ export default abstract class Command {
127
127
}
128
128
129
129
static set flags ( flags : Interfaces . FlagInput < any > ) {
130
- this . _flags = this . disableJsonFlag || settings . disableJsonFlag ? flags : Object . assign ( { } , Command . globalFlags , flags )
130
+ this . _flags = this . enableJsonFlag || settings . enableJsonFlag ? Object . assign ( { } , Command . globalFlags , flags ) : flags
131
131
}
132
132
133
133
id : string | undefined
@@ -193,7 +193,7 @@ export default abstract class Command {
193
193
}
194
194
195
195
public jsonEnabled ( ) : boolean {
196
- return ! this . ctor . disableJsonFlag && this . argv . includes ( '--json' )
196
+ return this . ctor . enableJsonFlag && this . argv . includes ( '--json' )
197
197
}
198
198
199
199
/**
Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ export type Settings = {
31
31
*/
32
32
tsnodeEnabled ?: boolean ;
33
33
/**
34
- * Disable the --json flag for all commands
34
+ * Enable the --json flag for all commands
35
35
*/
36
- disableJsonFlag ?: boolean ;
36
+ enableJsonFlag ?: boolean ;
37
37
} ;
38
38
39
39
// Set global.oclif to the new object if it wasn't set before
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ describe('formatCommand', () => {
45
45
static description = `first line
46
46
multiline help`
47
47
48
+ static enableJsonFlag = true
49
+
48
50
static args = [ { name : 'app_name' , description : 'app to use' } ]
49
51
50
52
static flags = {
@@ -97,6 +99,8 @@ ALIASES
97
99
98
100
static aliases = [ 'app:init' , 'create' ]
99
101
102
+ static enableJsonFlag = true
103
+
100
104
static args = [ { name : 'app_name' , description : 'app to use' . repeat ( 35 ) } ]
101
105
102
106
static flags = {
@@ -149,6 +153,8 @@ ALIASES
149
153
150
154
static aliases = [ 'app:init' , 'create' ]
151
155
156
+ static enableJsonFlag = true
157
+
152
158
static args = [ { name : 'app_name' , description : 'app to use' . repeat ( 35 ) } ]
153
159
154
160
static flags = {
@@ -238,6 +244,8 @@ DESCRIPTION
238
244
239
245
static aliases = [ 'app:init' , 'create' ]
240
246
247
+ static enableJsonFlag = true
248
+
241
249
static args = [ { name : 'app_name' , description : 'app to use' } ]
242
250
243
251
static flags = {
You can’t perform that action at this time.
0 commit comments