feat(completion): specify default output type for mmdc

This commit is contained in:
EmilyGraceSeville7cf 2024-10-01 07:11:15 +10:00
parent 06dde596f2
commit e22d901875
3 changed files with 17 additions and 13 deletions

View file

@ -19,7 +19,7 @@ complete -c $command -s h -l height -x \
complete -c $command -s i -l input -r -d 'Specify the input file of a chart' complete -c $command -s i -l input -r -d 'Specify the input file of a chart'
complete -c $command -s o -l output -r \ complete -c $command -s o -l output -r \
-a '(__fish_print_extensions svg md png pdf)' \ -a '(__fish_complete_extensions svg\tdefault md png pdf)' \
-d 'Specify the output file of a chart' -d 'Specify the output file of a chart'
complete -c $command -s e -l outputFormat -x \ complete -c $command -s e -l outputFormat -x \

View file

@ -0,0 +1,16 @@
function __fish_complete_extensions \
--description 'Suggest provided extensions as $argv if the current token ends with a dot'
set token (commandline -c -t)
switch "$token"
case '*.'
for extension in $argv
if string match --quiet --regex '\\\t|\t' -- $extension
echo -e "$token$extension"
else
printf "%s%s\n" $token $extension
end
end
end
end

View file

@ -1,12 +0,0 @@
function __fish_print_extensions \
--description 'Suggest provided extensions as $argv if the current token ends with a dot'
set token (commandline -c -t)
switch "$token"
case '*.'
for extension in $argv
printf "%s%s\n" $token $extension
end
end
end