@oclif/plugin-autocomplete
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -11,2 +11,3 @@ import { Config } from '@oclif/core'; | ||
private genHashtable; | ||
private sanitizeSummary; | ||
generate(): string; | ||
@@ -13,0 +14,0 @@ private getTopics; |
@@ -5,13 +5,3 @@ "use strict"; | ||
const os_1 = require("os"); | ||
function sanitizeSummary(description) { | ||
if (description === undefined) { | ||
// PowerShell: | ||
// [System.Management.Automation.CompletionResult] will error out if will error out if you pass in an empty string for the summary. | ||
return ' '; | ||
} | ||
return description | ||
.replace(/"/g, '""') // escape double quotes. | ||
.replace(/`/g, '``') // escape backticks. | ||
.split(os_1.EOL)[0]; // only use the first line | ||
} | ||
const ejs = require("ejs"); | ||
class PowerShellComp { | ||
@@ -50,3 +40,3 @@ constructor(config) { | ||
continue; | ||
const flagSummary = sanitizeSummary(f.summary || f.description); | ||
const flagSummary = this.sanitizeSummary(f.summary || f.description); | ||
if (f.type === 'option' && f.multiple) { | ||
@@ -118,2 +108,13 @@ flaghHashtables.push(` "${f.name}" = @{ | ||
} | ||
sanitizeSummary(summary) { | ||
if (summary === undefined) { | ||
// PowerShell: | ||
// [System.Management.Automation.CompletionResult] will error out if will error out if you pass in an empty string for the summary. | ||
return ' '; | ||
} | ||
return ejs.render(summary, { config: this.config }) | ||
.replace(/"/g, '""') // escape double quotes. | ||
.replace(/`/g, '``') // escape backticks. | ||
.split(os_1.EOL)[0]; // only use the first line | ||
} | ||
generate() { | ||
@@ -338,3 +339,3 @@ const genNode = (partialId) => { | ||
const description = t.description ? | ||
sanitizeSummary(t.description) : | ||
this.sanitizeSummary(t.description) : | ||
`${t.name.replace(/:/g, ' ')} commands`; | ||
@@ -354,3 +355,3 @@ return { | ||
return; | ||
const summary = sanitizeSummary(c.summary || c.description); | ||
const summary = this.sanitizeSummary(c.summary || c.description); | ||
const flags = c.flags; | ||
@@ -357,0 +358,0 @@ cmds.push({ |
@@ -8,2 +8,3 @@ import { Config } from '@oclif/core'; | ||
constructor(config: Config); | ||
private sanitizeSummary; | ||
generate(): string; | ||
@@ -10,0 +11,0 @@ private genZshFlagArgumentsBlock; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util = require("util"); | ||
function sanitizeSummary(description) { | ||
if (description === undefined) { | ||
return ''; | ||
} | ||
return description | ||
.replace(/([`"])/g, '\\\\\\$1') // backticks and double-quotes require triple-backslashes | ||
// eslint-disable-next-line no-useless-escape | ||
.replace(/([\[\]])/g, '\\\\$1') // square brackets require double-backslashes | ||
.split('\n')[0]; // only use the first line | ||
} | ||
const ejs = require("ejs"); | ||
const argTemplate = ' "%s")\n %s\n ;;\n'; | ||
@@ -21,2 +12,12 @@ class ZshCompWithSpaces { | ||
} | ||
sanitizeSummary(summary) { | ||
if (summary === undefined) { | ||
return ''; | ||
} | ||
return ejs.render(summary, { config: this.config }) | ||
.replace(/([`"])/g, '\\\\\\$1') // backticks and double-quotes require triple-backslashes | ||
// eslint-disable-next-line no-useless-escape | ||
.replace(/([\[\]])/g, '\\\\$1') // square brackets require double-backslashes | ||
.split('\n')[0]; // only use the first line | ||
} | ||
generate() { | ||
@@ -105,3 +106,3 @@ var _a, _b; | ||
continue; | ||
const flagSummary = sanitizeSummary(f.summary || f.description); | ||
const flagSummary = this.sanitizeSummary(f.summary || f.description); | ||
let flagSpec = ''; | ||
@@ -311,3 +312,3 @@ if (f.type === 'option') { | ||
.map(t => { | ||
const description = t.description ? sanitizeSummary(t.description) : `${t.name.replace(/:/g, ' ')} commands`; | ||
const description = t.description ? this.sanitizeSummary(t.description) : `${t.name.replace(/:/g, ' ')} commands`; | ||
return { | ||
@@ -326,3 +327,3 @@ name: t.name, | ||
return; | ||
const summary = sanitizeSummary(c.summary || c.description); | ||
const summary = this.sanitizeSummary(c.summary || c.description); | ||
const flags = c.flags; | ||
@@ -329,0 +330,0 @@ cmds.push({ |
{ | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"commands": { | ||
@@ -4,0 +4,0 @@ "autocomplete:create": { |
{ | ||
"name": "@oclif/plugin-autocomplete", | ||
"description": "autocomplete plugin for oclif", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"author": "Salesforce", | ||
@@ -17,2 +17,3 @@ "bugs": "https://github.com/oclif/plugin-autocomplete/issues", | ||
"@types/chai": "^4", | ||
"@types/ejs": "^3.1.2", | ||
"@types/fs-extra": "^9.0.13", | ||
@@ -31,3 +32,3 @@ "@types/mocha": "^8", | ||
"nyc": "^15.1.0", | ||
"oclif": "^3.9.0", | ||
"oclif": "^3.9.1", | ||
"shx": "^0.3.3", | ||
@@ -37,3 +38,3 @@ "sinon": "^12.0.1", | ||
"ts-node": "^9.0.0", | ||
"tslib": "^2.5.2", | ||
"tslib": "^2.5.3", | ||
"typescript": "4.6.3" | ||
@@ -40,0 +41,0 @@ }, |
@@ -60,3 +60,3 @@ @oclif/plugin-autocomplete | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v2.3.0/src/commands/autocomplete/index.ts)_ | ||
_See code: [src/commands/autocomplete/index.ts](https://github.com/oclif/plugin-autocomplete/blob/v2.3.1/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
60470
1376
3
24