@oclif/plugin-autocomplete
Advanced tools
Comparing version 1.4.6 to 2.1.0
@@ -6,2 +6,3 @@ "use strict"; | ||
const bash_1 = require("../../autocomplete/bash"); | ||
const zsh_1 = require("../../autocomplete/zsh"); | ||
const bash_spaces_1 = require("../../autocomplete/bash-spaces"); | ||
@@ -40,3 +41,11 @@ const base_1 = require("../../base"); | ||
await fs.writeFile(this.zshSetupScriptPath, this.zshSetupScript); | ||
await fs.writeFile(this.zshCompletionFunctionPath, this.zshCompletionFunction); | ||
// zsh | ||
const supportSpaces = this.config.topicSeparator === ' '; | ||
if (process.env.OCLIF_AUTOCOMPLETE_TOPIC_SEPARATOR === 'colon' || !supportSpaces) { | ||
await fs.writeFile(this.zshCompletionFunctionPath, this.zshCompletionFunction); | ||
} | ||
else { | ||
const zshCompWithSpaces = new zsh_1.default(this.config); | ||
await fs.writeFile(this.zshCompletionFunctionPath, zshCompWithSpaces.generate()); | ||
} | ||
} | ||
@@ -170,3 +179,4 @@ get bashSetupScriptPath() { | ||
const cliBin = this.cliBin; | ||
const bashScript = this.config.topicSeparator === ' ' ? bash_spaces_1.default : bash_1.default; | ||
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); | ||
@@ -173,0 +183,0 @@ } |
{ | ||
"version": "1.4.6", | ||
"version": "2.1.0", | ||
"commands": { | ||
@@ -4,0 +4,0 @@ "autocomplete:create": { |
{ | ||
"name": "@oclif/plugin-autocomplete", | ||
"description": "autocomplete plugin for oclif", | ||
"version": "1.4.6", | ||
"version": "2.1.0", | ||
"author": "Salesforce", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/plugin-autocomplete/issues", |
@@ -7,4 +7,2 @@ @oclif/plugin-autocomplete | ||
[![Version](https://img.shields.io/npm/v/@oclif/plugin-autocomplete.svg)](https://npmjs.org/package/@oclif/plugin-autocomplete) | ||
[![CircleCI](https://circleci.com/gh/oclif/plugin-autocomplete/tree/main.svg?style=shield)](https://circleci.com/gh/oclif/plugin-autocomplete/tree/main) | ||
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/plugin-autocomplete?branch=main&svg=true)](https://ci.appveyor.com/project/oclif/plugin-autocomplete/branch/main) | ||
[![Downloads/week](https://img.shields.io/npm/dw/@oclif/plugin-autocomplete.svg)](https://npmjs.org/package/@oclif/plugin-autocomplete) | ||
@@ -18,3 +16,14 @@ [![License](https://img.shields.io/npm/l/@oclif/plugin-autocomplete.svg)](https://github.com/oclif/plugin-autocomplete/blob/main/package.json) | ||
# Usage | ||
See https://oclif.io/docs/plugins.html | ||
Run `<cli> autocomplete` to generate the autocomplete files for your current shell. | ||
## Topic separator | ||
Since oclif v2 it's possible to use spaces as a topic separator in addition to colons. | ||
For bash and zsh each topic separator has different autocomplete implementations, if the CLI supports using a space as the separator, plugin-autocomplete will generate completion for that topic. | ||
If you still want to use the colon-separated autocomplete you can set `OCLIF_AUTOCOMPLETE_TOPIC_SEPARATOR` to `colon` and re-generate the autocomplete files. | ||
Docs: https://oclif.io/docs/topic_separator | ||
# Commands | ||
@@ -51,3 +60,3 @@ <!-- commands --> | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v1.4.6/src/commands/autocomplete/index.ts)_ | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v2.1.0/src/commands/autocomplete/index.ts)_ | ||
<!-- commandsstop --> |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
43286
20
947
60
5