@oclif/core 0.6.0 → 1.0.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/CHANGELOG.md +23 -0
- package/README.md +59 -3
- package/lib/command.js +1 -2
- package/lib/help/util.js +3 -3
- package/lib/settings.d.ts +0 -4
- package/package.json +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.3](https://github.com/oclif/core/compare/v1.0.2...v1.0.3) (2021-11-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* remove module lodash.template in favor of lodash ([#286](https://github.com/oclif/core/issues/286)) ([caaff0b](https://github.com/oclif/core/commit/caaff0b4918ab2e01bc01cad2c0d8158c2fcc1c5))
|
|
11
|
+
|
|
12
|
+
### [1.0.2](https://github.com/oclif/core/compare/v1.0.1...v1.0.2) (2021-10-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* remove ability to enable json flag globally ([#272](https://github.com/oclif/core/issues/272)) ([3c754e7](https://github.com/oclif/core/commit/3c754e7eee04ef078ff4ab08849191e6a5779ee0))
|
|
18
|
+
|
|
19
|
+
### [1.0.1](https://github.com/oclif/core/compare/v1.0.0...v1.0.1) (2021-10-08)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* use default separator if none is configured ([#271](https://github.com/oclif/core/issues/271)) ([602cf12](https://github.com/oclif/core/commit/602cf121ec676182a71a7e87b37714670cee0bf0))
|
|
25
|
+
|
|
26
|
+
## [1.0.0](https://github.com/oclif/core/compare/v0.6.0...v1.0.0) (2021-09-29)
|
|
27
|
+
|
|
5
28
|
## [0.6.0](https://github.com/oclif/core/compare/v0.5.41...v0.6.0) (2021-09-29)
|
|
6
29
|
|
|
7
30
|
|
package/README.md
CHANGED
|
@@ -4,8 +4,64 @@
|
|
|
4
4
|
base library for oclif CLIs
|
|
5
5
|
|
|
6
6
|
[](https://npmjs.org/package/@oclif/core)
|
|
7
|
-
[](https://circleci.com/gh/oclif/core/tree/main)
|
|
8
8
|
[](https://npmjs.org/package/@oclif/core)
|
|
9
|
-
[](https://github.com/oclif/core/blob/
|
|
9
|
+
[](https://github.com/oclif/core/blob/main/package.json)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
Usage
|
|
13
|
+
=====
|
|
14
|
+
|
|
15
|
+
Without the generator, you can create a simple CLI like this:
|
|
16
|
+
|
|
17
|
+
**TypeScript**
|
|
18
|
+
```js
|
|
19
|
+
#!/usr/bin/env ts-node
|
|
20
|
+
|
|
21
|
+
import * as fs from 'fs'
|
|
22
|
+
import {Command, flags} from '@oclif/core'
|
|
23
|
+
|
|
24
|
+
class LS extends Command {
|
|
25
|
+
static flags = {
|
|
26
|
+
version: flags.version(),
|
|
27
|
+
help: flags.help(),
|
|
28
|
+
// run with --dir= or -d=
|
|
29
|
+
dir: flags.string({
|
|
30
|
+
char: 'd',
|
|
31
|
+
default: process.cwd(),
|
|
32
|
+
}),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async run() {
|
|
36
|
+
const {flags} = this.parse(LS)
|
|
37
|
+
let files = fs.readdirSync(flags.dir)
|
|
38
|
+
for (let f of files) {
|
|
39
|
+
this.log(f)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
LS.run()
|
|
45
|
+
.catch(require('@oclif/errors/handle'))
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then run either of these with:
|
|
49
|
+
|
|
50
|
+
```sh-session
|
|
51
|
+
$ ./myscript
|
|
52
|
+
...files in current dir...
|
|
53
|
+
$ ./myscript --dir foobar
|
|
54
|
+
...files in ./foobar...
|
|
55
|
+
$ ./myscript --version
|
|
56
|
+
myscript/0.0.0 darwin-x64 node-v9.5.0
|
|
57
|
+
$ ./myscript --help
|
|
58
|
+
USAGE
|
|
59
|
+
$ @oclif/core
|
|
60
|
+
|
|
61
|
+
OPTIONS
|
|
62
|
+
-d, --dir=dir [default: /Users/jdickey/src/github.com/oclif/core]
|
|
63
|
+
--help show CLI help
|
|
64
|
+
--version show CLI version
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
See the [generator](https://github.com/oclif/oclif) for all the options you can pass to the command.
|
package/lib/command.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const url_1 = require("url");
|
|
4
|
-
const settings_1 = require("./settings");
|
|
5
4
|
const util_1 = require("util");
|
|
6
5
|
const cli_ux_1 = require("cli-ux");
|
|
7
6
|
const config_1 = require("./config");
|
|
@@ -38,7 +37,7 @@ class Command {
|
|
|
38
37
|
return this._flags;
|
|
39
38
|
}
|
|
40
39
|
static set flags(flags) {
|
|
41
|
-
this._flags = this.enableJsonFlag
|
|
40
|
+
this._flags = this.enableJsonFlag ? Object.assign({}, Command.globalFlags, flags) : flags;
|
|
42
41
|
}
|
|
43
42
|
get ctor() {
|
|
44
43
|
return this.constructor;
|
package/lib/help/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.standardizeIDFromArgv = exports.toConfiguredId = exports.toStandardizedId = exports.template = exports.loadHelpClass = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _ = require("lodash");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const module_loader_1 = require("../module-loader");
|
|
7
7
|
function extractClass(exported) {
|
|
@@ -24,7 +24,7 @@ async function loadHelpClass(config) {
|
|
|
24
24
|
exports.loadHelpClass = loadHelpClass;
|
|
25
25
|
function template(context) {
|
|
26
26
|
function render(t) {
|
|
27
|
-
return
|
|
27
|
+
return _.template(t)(context);
|
|
28
28
|
}
|
|
29
29
|
return render;
|
|
30
30
|
}
|
|
@@ -75,7 +75,7 @@ function toStandardizedId(commandID, config) {
|
|
|
75
75
|
exports.toStandardizedId = toStandardizedId;
|
|
76
76
|
function toConfiguredId(commandID, config) {
|
|
77
77
|
const defaultTopicSeperator = ':';
|
|
78
|
-
return commandID.replace(new RegExp(defaultTopicSeperator, 'g'), config.topicSeparator);
|
|
78
|
+
return commandID.replace(new RegExp(defaultTopicSeperator, 'g'), config.topicSeparator || defaultTopicSeperator);
|
|
79
79
|
}
|
|
80
80
|
exports.toConfiguredId = toConfiguredId;
|
|
81
81
|
function standardizeIDFromArgv(argv, config) {
|
package/lib/settings.d.ts
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": "0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"author": "Jeff Dickey @jdxcode",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"globby": "^11.0.1",
|
|
16
16
|
"indent-string": "^4.0.0",
|
|
17
17
|
"is-wsl": "^2.1.1",
|
|
18
|
-
"lodash
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
19
|
"semver": "^7.3.2",
|
|
20
20
|
"string-width": "^4.2.0",
|
|
21
21
|
"strip-ansi": "^6.0.0",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@commitlint/config-conventional": "^12.1.1",
|
|
28
|
-
"@oclif/plugin-help": "^
|
|
29
|
-
"@oclif/plugin-legacy": "^1.
|
|
30
|
-
"@oclif/plugin-plugins": "^1.
|
|
31
|
-
"@oclif/test": "^1.2.
|
|
28
|
+
"@oclif/plugin-help": "^5.1.2",
|
|
29
|
+
"@oclif/plugin-legacy": "^1.2.0",
|
|
30
|
+
"@oclif/plugin-plugins": "^1.10.1",
|
|
31
|
+
"@oclif/test": "^1.2.8",
|
|
32
32
|
"@types/chai": "^4.1.7",
|
|
33
33
|
"@types/chai-as-promised": "^7.1.3",
|
|
34
34
|
"@types/clean-stack": "^2.1.1",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"fancy-test": "^1.4.3",
|
|
55
55
|
"globby": "^11.0.1",
|
|
56
56
|
"husky": "6",
|
|
57
|
-
"lodash": "^4.17.11",
|
|
58
57
|
"mocha": "^8.1.3",
|
|
59
58
|
"nock": "^13.0.0",
|
|
60
59
|
"proxyquire": "^2.1.0",
|