@wooksjs/event-cli 0.3.1 → 0.3.2

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/dist/index.cjs CHANGED
@@ -98,6 +98,7 @@ class WooksCli extends wooks.WooksAdapterBase {
98
98
  * @returns
99
99
  */
100
100
  cli(path, _options) {
101
+ var _a;
101
102
  const options = typeof _options === 'function' ? { handler: _options } : _options;
102
103
  const handler = typeof _options === 'function' ? _options : _options.handler;
103
104
  const makePath = (s) => '/' + s.replace(/\s+/g, '/');
@@ -126,7 +127,7 @@ class WooksCli extends wooks.WooksAdapterBase {
126
127
  }
127
128
  this.cliHelp.addEntry({
128
129
  command,
129
- aliases: options.aliases,
130
+ aliases: (_a = options.aliases) === null || _a === void 0 ? void 0 : _a.map(alias => alias.replace(/\\:/g, ':')),
130
131
  args,
131
132
  description: options.description,
132
133
  examples: options.examples,
@@ -170,10 +171,7 @@ class WooksCli extends wooks.WooksAdapterBase {
170
171
  var _a, _b;
171
172
  return __awaiter(this, void 0, void 0, function* () {
172
173
  const argv = _argv || process.argv.slice(2);
173
- const firstFlagIndex = argv.findIndex((a) => a.startsWith('-')) + 1;
174
- const pathParams = firstFlagIndex
175
- ? argv.slice(0, firstFlagIndex - 1)
176
- : argv;
174
+ const pathParams = argv.filter(a => !a.startsWith('-'));
177
175
  const path = '/' +
178
176
  pathParams.map((v) => encodeURI(v).replace(/\//g, '%2F')).join('/');
179
177
  const { restoreCtx, clearCtx, store } = createCliContext({ argv, pathParams, cliHelp: this.cliHelp, command: path.replace(/\//g, ' ').trim() }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
package/dist/index.mjs CHANGED
@@ -96,6 +96,7 @@ class WooksCli extends WooksAdapterBase {
96
96
  * @returns
97
97
  */
98
98
  cli(path, _options) {
99
+ var _a;
99
100
  const options = typeof _options === 'function' ? { handler: _options } : _options;
100
101
  const handler = typeof _options === 'function' ? _options : _options.handler;
101
102
  const makePath = (s) => '/' + s.replace(/\s+/g, '/');
@@ -124,7 +125,7 @@ class WooksCli extends WooksAdapterBase {
124
125
  }
125
126
  this.cliHelp.addEntry({
126
127
  command,
127
- aliases: options.aliases,
128
+ aliases: (_a = options.aliases) === null || _a === void 0 ? void 0 : _a.map(alias => alias.replace(/\\:/g, ':')),
128
129
  args,
129
130
  description: options.description,
130
131
  examples: options.examples,
@@ -168,10 +169,7 @@ class WooksCli extends WooksAdapterBase {
168
169
  var _a, _b;
169
170
  return __awaiter(this, void 0, void 0, function* () {
170
171
  const argv = _argv || process.argv.slice(2);
171
- const firstFlagIndex = argv.findIndex((a) => a.startsWith('-')) + 1;
172
- const pathParams = firstFlagIndex
173
- ? argv.slice(0, firstFlagIndex - 1)
174
- : argv;
172
+ const pathParams = argv.filter(a => !a.startsWith('-'));
175
173
  const path = '/' +
176
174
  pathParams.map((v) => encodeURI(v).replace(/\//g, '%2F')).join('/');
177
175
  const { restoreCtx, clearCtx, store } = createCliContext({ argv, pathParams, cliHelp: this.cliHelp, command: path.replace(/\//g, ' ').trim() }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "@wooksjs/event-cli",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "url": "https://github.com/wooksjs/wooksjs/issues"
32
32
  },
33
33
  "peerDependencies": {
34
- "wooks": "0.3.1",
35
- "@wooksjs/event-core": "0.3.1"
34
+ "wooks": "0.3.2",
35
+ "@wooksjs/event-core": "0.3.2"
36
36
  },
37
37
  "dependencies": {
38
38
  "minimist": "^1.2.6",