@oclif/core 4.3.1 → 4.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -2
- package/lib/command.js +1 -1
- package/lib/flags.js +1 -1
- package/lib/parser/parse.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -84,7 +84,25 @@ class LS extends Command {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
LS.run(
|
|
87
|
+
LS.run(process.argv.slice(2), {
|
|
88
|
+
root: import.meta.dirname,
|
|
89
|
+
// Tell oclif what the contents of the package.json are.
|
|
90
|
+
// You could also set these in your package.json but specifying
|
|
91
|
+
// them here is useful if you're attempting to bundle your CLI
|
|
92
|
+
// without a package.json
|
|
93
|
+
pjson: {
|
|
94
|
+
name: 'ls',
|
|
95
|
+
version: '0.0.1',
|
|
96
|
+
oclif: {
|
|
97
|
+
// Tell oclif that this is a single command CLI
|
|
98
|
+
// See: https://oclif.io/docs/command_discovery_strategies
|
|
99
|
+
commands: {
|
|
100
|
+
strategy: 'single',
|
|
101
|
+
target: 'index.js',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}).then(
|
|
88
106
|
async () => {
|
|
89
107
|
await flush()
|
|
90
108
|
},
|
|
@@ -116,7 +134,7 @@ const {args, flags} = await Parser.parse(process.argv.slice(2), {
|
|
|
116
134
|
},
|
|
117
135
|
})
|
|
118
136
|
|
|
119
|
-
console.log(`hello ${args.name} from ${flags.
|
|
137
|
+
console.log(`hello ${args.name} from ${flags.from}`)
|
|
120
138
|
```
|
|
121
139
|
|
|
122
140
|
```
|
|
@@ -125,6 +143,8 @@ $ node index.js world --from oclif
|
|
|
125
143
|
hello world from oclif
|
|
126
144
|
```
|
|
127
145
|
|
|
146
|
+
**NOTE** If you're using the `Parser` class, you will not be able to use the builtin `help` and `version` flags since those require the context of an oclif project.
|
|
147
|
+
|
|
128
148
|
🚀 Contributing
|
|
129
149
|
|
|
130
150
|
See the [contributing guide](./CONRTIBUTING.md).
|
package/lib/command.js
CHANGED
|
@@ -227,7 +227,7 @@ class Command {
|
|
|
227
227
|
*/
|
|
228
228
|
jsonEnabled() {
|
|
229
229
|
// If the command doesn't support json, return false
|
|
230
|
-
if (!this.ctor
|
|
230
|
+
if (!this.ctor?.enableJsonFlag)
|
|
231
231
|
return false;
|
|
232
232
|
// If the CONTENT_TYPE env var is set to json, return true
|
|
233
233
|
if (this.config.scopedEnvVar?.('CONTENT_TYPE')?.toLowerCase() === 'json')
|
package/lib/flags.js
CHANGED
|
@@ -14,7 +14,7 @@ function custom(defaults) {
|
|
|
14
14
|
...defaults,
|
|
15
15
|
...options,
|
|
16
16
|
input: [],
|
|
17
|
-
multiple: Boolean(options.multiple === undefined ? defaults?.multiple ?? false : options.multiple),
|
|
17
|
+
multiple: Boolean(options.multiple === undefined ? (defaults?.multiple ?? false) : options.multiple),
|
|
18
18
|
type: 'option',
|
|
19
19
|
});
|
|
20
20
|
}
|
package/lib/parser/parse.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.3",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"semver": "^7.6.3",
|
|
20
20
|
"string-width": "^4.2.3",
|
|
21
21
|
"supports-color": "^8",
|
|
22
|
-
"tinyglobby": "^0.2.
|
|
22
|
+
"tinyglobby": "^0.2.14",
|
|
23
23
|
"widest-line": "^3.1.0",
|
|
24
24
|
"wordwrap": "^1.0.0",
|
|
25
25
|
"wrap-ansi": "^7.0.0"
|