Skip to content

Commit

Permalink
fix: allow to switch between comp implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Feb 14, 2023
1 parent be3dee4 commit e9b42aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/autocomplete/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class Create extends AutocompleteBase {
await fs.writeFile(this.zshSetupScriptPath, this.zshSetupScript)

// zsh
if (this.config.topicSeparator === ':') {
if (process.env.OCLIF_AUTOCOMPLETE_TOPIC_SEPARATOR === 'colon') {
await fs.writeFile(this.zshCompletionFunctionPath, this.zshCompletionFunction)
} else {
const zshCompWithSpaces = new ZshCompWithSpaces(this.config)
Expand Down Expand Up @@ -204,7 +204,7 @@ compinit;\n`

private get bashCompletionFunction(): string {
const cliBin = this.cliBin
const bashScript = this.config.topicSeparator === ' ' ? bashAutocompleteWithSpaces : bashAutocomplete
const bashScript = process.env.OCLIF_AUTOCOMPLETE_TOPIC_SEPARATOR === 'colon' ? bashAutocomplete : bashAutocompleteWithSpaces
return bashScript.replace(/<CLI_BIN>/g, cliBin).replace(/<BASH_COMMANDS_WITH_FLAGS_LIST>/g, this.bashCommandsWithFlagsList)
}

Expand Down

0 comments on commit e9b42aa

Please sign in to comment.