@oclif/plugin-autocomplete
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -198,3 +198,3 @@ "use strict"; | ||
$Commands = ${commandsHashtable} | ||
$Commands =${commandsHashtable} | ||
@@ -264,7 +264,7 @@ # Get the current mode | ||
if ($WordToComplete -like '-*') { | ||
$NextArg._command.flags.GetEnumerator() | Sort-Object -Property key | ||
$NextArg._command.flags.GetEnumerator() | Sort-Object -Property key | ||
| Where-Object { | ||
# Filter out already used flags (unless \`flag.multiple = true\`). | ||
$_.Key.StartsWith("$($WordToComplete.Trim("-"))") -and ($_.Value.multiple -eq $true -or !$flags.Contains($_.Key)) | ||
} | ||
} | ||
| ForEach-Object { | ||
@@ -315,3 +315,3 @@ New-Object -Type CompletionResult -ArgumentList \` | ||
} | ||
Register-ArgumentCompleter -Native -CommandName ${this.config.bin} -ScriptBlock $scriptblock | ||
Register-ArgumentCompleter -Native -CommandName ${this.config.binAliases ? `@(${[...this.config.binAliases, this.config.bin].map(alias => `"${alias}"`).join(',')})` : this.config.bin} -ScriptBlock $scriptblock | ||
`; | ||
@@ -318,0 +318,0 @@ return compRegister; |
@@ -22,2 +22,3 @@ "use strict"; | ||
generate() { | ||
var _a, _b; | ||
const firstArgs = []; | ||
@@ -63,3 +64,4 @@ this.topics.forEach(t => { | ||
}; | ||
const compFunc = `#compdef ${this.config.bin} | ||
return `#compdef ${this.config.bin} | ||
${(_b = (_a = this.config.binAliases) === null || _a === void 0 ? void 0 : _a.map(a => `compdef ${a}=${this.config.bin}`).join('\n')) !== null && _b !== void 0 ? _b : ''} | ||
@@ -76,3 +78,3 @@ ${this.topics.map(t => this.genZshTopicCompFun(t.name)).join('\n')} | ||
cmds) | ||
${this.genZshValuesBlock(firstArgs)} | ||
${this.genZshValuesBlock(firstArgs)} | ||
;; | ||
@@ -87,3 +89,2 @@ args) | ||
`; | ||
return compFunc; | ||
} | ||
@@ -277,3 +278,3 @@ genZshFlagArgumentsBlock(flags) { | ||
;; | ||
esac | ||
esac | ||
} | ||
@@ -280,0 +281,0 @@ `; |
@@ -188,6 +188,10 @@ "use strict"; | ||
get bashCompletionFunction() { | ||
var _a, _b; | ||
const cliBin = this.cliBin; | ||
const supportSpaces = this.config.topicSeparator === ' '; | ||
const bashScript = (process.env.OCLIF_AUTOCOMPLETE_TOPIC_SEPARATOR === 'colon' || !supportSpaces) ? bash_1.default : bash_spaces_1.default; | ||
return bashScript.replace(/<CLI_BIN>/g, cliBin).replace(/<BASH_COMMANDS_WITH_FLAGS_LIST>/g, this.bashCommandsWithFlagsList); | ||
return bashScript | ||
.concat(...((_b = (_a = this.config.binAliases) === null || _a === void 0 ? void 0 : _a.map(alias => `complete -F _<CLI_BIN>_autocomplete ${alias}`).join('\n')) !== null && _b !== void 0 ? _b : [])) | ||
.replace(/<CLI_BIN>/g, cliBin) | ||
.replace(/<BASH_COMMANDS_WITH_FLAGS_LIST>/g, this.bashCommandsWithFlagsList); | ||
} | ||
@@ -194,0 +198,0 @@ get zshCompletionFunction() { |
{ | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"commands": { | ||
@@ -4,0 +4,0 @@ "autocomplete:create": { |
{ | ||
"name": "@oclif/plugin-autocomplete", | ||
"description": "autocomplete plugin for oclif", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"author": "Salesforce", | ||
@@ -35,3 +35,3 @@ "bugs": "https://github.com/oclif/plugin-autocomplete/issues", | ||
"ts-node": "^9.0.0", | ||
"tslib": "^2.5.0", | ||
"tslib": "^2.5.2", | ||
"typescript": "4.6.3" | ||
@@ -38,0 +38,0 @@ }, |
@oclif/plugin-autocomplete | ||
========================== | ||
autocomplete plugin for oclif (bash & zsh) | ||
autocomplete plugin for oclif (bash, zsh and powershell) | ||
@@ -60,3 +60,3 @@ [![Version](https://img.shields.io/npm/v/@oclif/plugin-autocomplete.svg)](https://npmjs.org/package/@oclif/plugin-autocomplete) | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v2.2.0/src/commands/autocomplete/index.ts)_ | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v2.3.0/src/commands/autocomplete/index.ts)_ | ||
<!-- commandsstop --> |
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
60182
1372