@optique/core 1.0.15-dev.2849 → 1.0.15-dev.2854
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/completion.cjs +10 -3
- package/dist/completion.js +10 -3
- package/package.json +1 -1
package/dist/completion.cjs
CHANGED
|
@@ -679,8 +679,9 @@ const zsh = {
|
|
|
679
679
|
generateScript(programName, args = []) {
|
|
680
680
|
validateProgramName(programName);
|
|
681
681
|
const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "'\\''")}'`).join(" ");
|
|
682
|
+
const functionName = /[.-]/.test(programName) ? `_optique:${programName}` : `_${programName}`;
|
|
682
683
|
return `#compdef ${programName}
|
|
683
|
-
function
|
|
684
|
+
function ${functionName} () {
|
|
684
685
|
local current="\$words[CURRENT]"
|
|
685
686
|
local -a prev
|
|
686
687
|
# Extract previous arguments, skipping empty ones
|
|
@@ -829,7 +830,13 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
|
|
|
829
830
|
}
|
|
830
831
|
|
|
831
832
|
if (( $+functions[compdef] )); then
|
|
832
|
-
compdef
|
|
833
|
+
compdef ${functionName} ${programName}
|
|
834
|
+
fi
|
|
835
|
+
|
|
836
|
+
# An autoloaded file runs as a function body. Dispatch its initial request;
|
|
837
|
+
# sourcing the file only defines and registers the completion helper.
|
|
838
|
+
if [[ \$ZSH_EVAL_CONTEXT == *:loadautofunc || \$ZSH_EVAL_CONTEXT == *:shfunc ]]; then
|
|
839
|
+
${functionName} "\$@"
|
|
833
840
|
fi
|
|
834
841
|
`;
|
|
835
842
|
},
|
|
@@ -855,7 +862,7 @@ const fish = {
|
|
|
855
862
|
generateScript(programName, args = []) {
|
|
856
863
|
validateProgramName(programName);
|
|
857
864
|
const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "\\'")}'`).join(" ");
|
|
858
|
-
const functionName = `__${programName
|
|
865
|
+
const functionName = `__${programName}_complete`;
|
|
859
866
|
return `
|
|
860
867
|
function ${functionName}
|
|
861
868
|
set -l tokens (commandline -poc)
|
package/dist/completion.js
CHANGED
|
@@ -679,8 +679,9 @@ const zsh = {
|
|
|
679
679
|
generateScript(programName, args = []) {
|
|
680
680
|
validateProgramName(programName);
|
|
681
681
|
const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "'\\''")}'`).join(" ");
|
|
682
|
+
const functionName = /[.-]/.test(programName) ? `_optique:${programName}` : `_${programName}`;
|
|
682
683
|
return `#compdef ${programName}
|
|
683
|
-
function
|
|
684
|
+
function ${functionName} () {
|
|
684
685
|
local current="\$words[CURRENT]"
|
|
685
686
|
local -a prev
|
|
686
687
|
# Extract previous arguments, skipping empty ones
|
|
@@ -829,7 +830,13 @@ function _${programName.replace(/[^a-zA-Z0-9]/g, "_")} () {
|
|
|
829
830
|
}
|
|
830
831
|
|
|
831
832
|
if (( $+functions[compdef] )); then
|
|
832
|
-
compdef
|
|
833
|
+
compdef ${functionName} ${programName}
|
|
834
|
+
fi
|
|
835
|
+
|
|
836
|
+
# An autoloaded file runs as a function body. Dispatch its initial request;
|
|
837
|
+
# sourcing the file only defines and registers the completion helper.
|
|
838
|
+
if [[ \$ZSH_EVAL_CONTEXT == *:loadautofunc || \$ZSH_EVAL_CONTEXT == *:shfunc ]]; then
|
|
839
|
+
${functionName} "\$@"
|
|
833
840
|
fi
|
|
834
841
|
`;
|
|
835
842
|
},
|
|
@@ -855,7 +862,7 @@ const fish = {
|
|
|
855
862
|
generateScript(programName, args = []) {
|
|
856
863
|
validateProgramName(programName);
|
|
857
864
|
const escapedArgs = args.map((arg) => `'${arg.replace(/'/g, "\\'")}'`).join(" ");
|
|
858
|
-
const functionName = `__${programName
|
|
865
|
+
const functionName = `__${programName}_complete`;
|
|
859
866
|
return `
|
|
860
867
|
function ${functionName}
|
|
861
868
|
set -l tokens (commandline -poc)
|