@clerc/plugin-completions 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ ${Object.keys(o).map(c).join("")}
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
complete -F _${t} -o bashdefault -o default ${t}
|
|
26
|
-
`},i=e=>e.replace(/([A-Z])/g,(n,t)=>`-${t.toLowerCase()}`),r=e=>e.length<=1?`-${e}`:`--${i(e)}`,
|
|
26
|
+
`},i=e=>e.replace(/([A-Z])/g,(n,t)=>`-${t.toLowerCase()}`),r=e=>e.length<=1?`-${e}`:`--${i(e)}`,a="(No Description)",u=e=>`[CompletionResult]::new('${e.name}', '${e.name}', [CompletionResultType]::ParameterValue, '${e.description}')`,d=e=>Object.entries(e.flags||{}).map(([n,t])=>{const o=[`[CompletionResult]::new('${r(n)}', '${i(n)}', [CompletionResultType]::ParameterName, '${e.flags[n].description||a}')`];return t!=null&&t.alias&&o.push(`[CompletionResult]::new('${r(t.alias)}', '${t.alias}', [CompletionResultType]::ParameterName, '${e.flags[n].description||a}')`),o.join(`
|
|
27
27
|
`)}).join(`
|
|
28
28
|
`),C=e=>{const{cli:n}=e,{_name:t,_commands:o}=n;return`using namespace System.Management.Automation
|
|
29
29
|
using namespace System.Management.Automation.Language
|
|
@@ -60,4 +60,4 @@ Register-ArgumentCompleter -Native -CommandName '${t}' -ScriptBlock {
|
|
|
60
60
|
|
|
61
61
|
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
|
62
62
|
Sort-Object -Property ListItemText
|
|
63
|
-
}`},
|
|
63
|
+
}`},l={bash:$,pwsh:C},g=(e={})=>p({setup:n=>{const{command:t=!0}=e;return t&&(n=n.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",o=>{if(!n._name)throw new Error("CLI name is not defined!");const s=String(o.parameters.shell||o.flags.shell);if(!s)throw new Error("Missing shell name");if(s in l)process.stdout.write(l[s](o));else throw new Error(`No such shell: ${s}`)})),n}});export{g as completionsPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-completions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
|
|
5
5
|
"description": "Clerc plugin completions",
|
|
6
6
|
"keywords": [
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@clerc/core": "*"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@clerc/core": "0.
|
|
55
|
-
"@clerc/utils": "0.
|
|
54
|
+
"@clerc/core": "0.29.0",
|
|
55
|
+
"@clerc/utils": "0.29.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "puild --minify",
|