@clerc/core
Advanced tools
Comparing version 0.18.0 to 0.19.0
@@ -215,3 +215,3 @@ import { LiteEmit } from 'lite-emit'; | ||
}; | ||
var _name, _description, _version, _inspectors, _commands, _commandEmitter, _isSingleCommand, isSingleCommand_get, _hasCommands, hasCommands_get; | ||
var _name, _description, _version, _inspectors, _commands, _commandEmitter, _usedNames, _isSingleCommand, isSingleCommand_get, _hasCommands, hasCommands_get; | ||
const SingleCommand = Symbol("SingleCommand"); | ||
@@ -228,2 +228,3 @@ const _Clerc = class { | ||
__privateAdd(this, _commandEmitter, new LiteEmit()); | ||
__privateAdd(this, _usedNames, []); | ||
} | ||
@@ -285,3 +286,3 @@ get _name() { | ||
for (const name2 of nameList) { | ||
if (Object.keys(__privateGet(this, _commands)).includes(name2) || Object.values(__privateGet(this, _commands)).some(({ alias }) => alias ? toArray(alias).includes(name2) : false)) { | ||
if (__privateGet(this, _usedNames).includes(name2)) { | ||
throw new CommandExistsError(name2); | ||
@@ -291,2 +292,3 @@ } | ||
__privateGet(this, _commands)[name] = commandToSave; | ||
__privateGet(this, _usedNames).push(commandToSave.name, ...toArray(commandToSave.alias) || []); | ||
isCommandObject && handler && this.on(nameOrCommand.name, handler); | ||
@@ -325,3 +327,3 @@ return this; | ||
const parsed = typeFlag((command == null ? void 0 : command.flags) || {}, [...argv]); | ||
const { _: args, flags } = parsed; | ||
const { _: args, flags, unknownFlags } = parsed; | ||
let parameters = __privateGet(this, _isSingleCommand, isSingleCommand_get) || !isCommandResolved ? args : args.slice(command.name.split(" ").length); | ||
@@ -334,3 +336,3 @@ let commandParameters = (command == null ? void 0 : command.parameters) || []; | ||
commandParameters = commandParameters.slice(0, hasEof); | ||
const eofArguments = parsed._["--"]; | ||
const eofArguments = args["--"]; | ||
parameters = parameters.slice(0, -eofArguments.length || void 0); | ||
@@ -354,3 +356,3 @@ mapErrors.push(mapParametersToArguments( | ||
} | ||
const mergedFlags = { ...parsed.flags, ...parsed.unknownFlags }; | ||
const mergedFlags = { ...flags, ...unknownFlags }; | ||
const context = { | ||
@@ -363,3 +365,3 @@ name: command == null ? void 0 : command.name, | ||
flags, | ||
unknownFlags: parsed.unknownFlags, | ||
unknownFlags, | ||
cli: this | ||
@@ -401,2 +403,3 @@ }; | ||
_commandEmitter = new WeakMap(); | ||
_usedNames = new WeakMap(); | ||
_isSingleCommand = new WeakSet(); | ||
@@ -403,0 +406,0 @@ isSingleCommand_get = function() { |
{ | ||
"name": "@clerc/core", | ||
"version": "0.18.0", | ||
"version": "0.19.0", | ||
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)", | ||
@@ -53,3 +53,3 @@ "description": "Clerc core", | ||
"type-flag": "^3.0.0", | ||
"@clerc/utils": "0.18.0" | ||
"@clerc/utils": "0.19.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44827
1145
+ Added@clerc/utils@0.19.0(transitive)
- Removed@clerc/utils@0.18.0(transitive)
Updated@clerc/utils@0.19.0