Add support for the --parallel argument in shell scripts.

This commit is contained in:
Username404-59 2021-07-07 19:07:47 +02:00
parent b7eb32c636
commit 3f4aed1389
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
4 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@ _ybconAutoComplete() {
COMPREPLY=()
current="${COMP_WORDS[COMP_CWORD]}"
previous="${COMP_WORDS[COMP_CWORD-1]}"
options='-h -p --help --target= --printresult --version'
options='-h -p --help --parallel --target= --printresult --version'
if [[ "${current}" == -* ]]; then
YCompReply "$(compgen -W "$options" -- "$current")"
return 0

View File

@ -3,5 +3,6 @@ set -l commands --version -h --help --target= -p --printresult
complete -c ybcon -f -a "(__fish_complete_suffix .ybcon)"
complete -c ybcon -x -s h -l help -d "Print the help screen"
complete -c ybcon -x -l version -d "Print the version"
complete -c ybcon -l parallel -k -d "Transpile files in parallel mode"
complete -c ybcon -l target -k -f -a 'lua js py' -d "Set the transpilation target"
complete -c ybcon -s p -l printresult -d "Enable printing the transpilation result to stdout"

View File

@ -4,6 +4,7 @@ _ybcon() {
_arguments \
'( - 0)'{-h,--help}'[Print the help screen]' \
'( - 0)'--version'[Print the version]' \
--parallel'[Transpile files in parallel mode]' \
--target='[Set the transpilation target]:language:(lua js py)' \
{-p,--printresult}'[Enable printing the transpilation result to stdout]' \
"*:$completeyfile"

View File

@ -11,10 +11,11 @@ defaultBinLocation="$scriptDir/../libexec/ybcon"
usage() {
if [ "$1" = false ]; then echo "Invalid arguments, usage:"; fi
echo "$EXENAME [--version] [-h|--help] [--target=<target>] [-p|--printresult] <file>"
echo "$EXENAME [--version] [-h|--help] [--parallel] [--target=<target>] [-p|--printresult] <file>"
if [ "$1" = true ]; then
echo " --version Print the version"
echo " -h or --help What you're seeing right now"
echo " --parallel Transpile files in parallel mode"
echo " --target=<target> Set the transpilation target"
echo " -p or --printresult Enable printing the transpilation result to stdout"
printf "\n"
@ -53,7 +54,7 @@ if [ "$#" != 0 ]; then
for it in "$@"
do
case "$it" in
-p | --printresult | --target=* )
-p | --printresult | --parallel | --target=* )
if test "${args#*$it}" = "$args"; then
newArgs "$it"
else