Support "--newlines=on/off" and "--buildInfo" in the shell scripts
This commit is contained in:
parent
2cf523bf17
commit
62204d480e
|
@ -8,7 +8,7 @@ _ybconAutoComplete() {
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
current="${COMP_WORDS[COMP_CWORD]}"
|
current="${COMP_WORDS[COMP_CWORD]}"
|
||||||
previous="${COMP_WORDS[COMP_CWORD-1]}"
|
previous="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
options='-h -p --help --parallel --target= --printresult --version'
|
options='-h -p --help --parallel --target= --newlines= --printresult --version --buildInfo'
|
||||||
if [[ "${current}" == -* ]]; then
|
if [[ "${current}" == -* ]]; then
|
||||||
YCompReply "$(compgen -W "$options" -- "$current")"
|
YCompReply "$(compgen -W "$options" -- "$current")"
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -3,6 +3,8 @@ set -l commands --version -h --help --target= -p --printresult
|
||||||
complete -c ybcon -f -a "(__fish_complete_suffix .ybcon)"
|
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 -s h -l help -d "Print the help screen"
|
||||||
complete -c ybcon -x -l version -d "Print the version"
|
complete -c ybcon -x -l version -d "Print the version"
|
||||||
|
complete -c ybcon -x -l buildInfo -d "Print the compiler name and the optimization flags used to build the ybcon executable"
|
||||||
complete -c ybcon -l parallel -k -d "Transpile files in parallel mode"
|
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 -l target -k -f -a 'lua js py' -d "Set the transpilation target"
|
||||||
|
complete -c ybcon -l newlines -k -f -a 'on off' -d "Enable or disable new lines"
|
||||||
complete -c ybcon -s p -l printresult -d "Enable printing the transpilation result to stdout"
|
complete -c ybcon -s p -l printresult -d "Enable printing the transpilation result to stdout"
|
|
@ -4,8 +4,10 @@ _ybcon() {
|
||||||
_arguments \
|
_arguments \
|
||||||
'( - 0)'{-h,--help}'[Print the help screen]' \
|
'( - 0)'{-h,--help}'[Print the help screen]' \
|
||||||
'( - 0)'--version'[Print the version]' \
|
'( - 0)'--version'[Print the version]' \
|
||||||
|
'( - 0)'--buildInfo'[Print the compiler name and the optimization flags used to build the ybcon executable]' \
|
||||||
--parallel'[Transpile files in parallel mode]' \
|
--parallel'[Transpile files in parallel mode]' \
|
||||||
--target='[Set the transpilation target]:language:(lua js py)' \
|
--target='[Set the transpilation target]:language:(lua js py)' \
|
||||||
|
--newlines='[Enable or disable new lines]:state:(on off)' \
|
||||||
{-p,--printresult}'[Enable printing the transpilation result to stdout]' \
|
{-p,--printresult}'[Enable printing the transpilation result to stdout]' \
|
||||||
"*:$completeyfile"
|
"*:$completeyfile"
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -11,12 +11,14 @@ defaultBinLocation="$scriptDir/../libexec/ybcon"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
if [ "$1" = false ]; then echo "Invalid arguments, usage:"; fi
|
if [ "$1" = false ]; then echo "Invalid arguments, usage:"; fi
|
||||||
echo "$EXENAME [--version] [-h|--help] [--parallel] [--target=<target>] [-p|--printresult] <file>"
|
echo "$EXENAME [--version] [--buildInfo] [-h|--help] [--parallel] [--target=<target>] [--newlines=on/off] [-p|--printresult] <file>"
|
||||||
if [ "$1" = true ]; then
|
if [ "$1" = true ]; then
|
||||||
echo " --version Print the version"
|
echo " --version Print the version"
|
||||||
|
echo " --buildInfo Print the compiler name and the optimization flags used to build the ybcon executable"
|
||||||
echo " -h or --help What you're seeing right now"
|
echo " -h or --help What you're seeing right now"
|
||||||
echo " --parallel Transpile files in parallel mode"
|
echo " --parallel Transpile files in parallel mode"
|
||||||
echo " --target=<target> Set the transpilation target"
|
echo " --target=<target> Set the transpilation target"
|
||||||
|
echo " --newlines=on/off Enable or disable new lines"
|
||||||
echo " -p or --printresult Enable printing the transpilation result to stdout"
|
echo " -p or --printresult Enable printing the transpilation result to stdout"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +45,7 @@ if [ "$#" != 0 ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | --help )
|
-h | --help )
|
||||||
helpExit ;;
|
helpExit ;;
|
||||||
--version )
|
--version | --buildInfo )
|
||||||
run=true; args="$1" ;;
|
run=true; args="$1" ;;
|
||||||
*.ybcon )
|
*.ybcon )
|
||||||
newArgs "$1"; run=true ;;
|
newArgs "$1"; run=true ;;
|
||||||
|
@ -54,7 +56,7 @@ if [ "$#" != 0 ]; then
|
||||||
for it in "$@"
|
for it in "$@"
|
||||||
do
|
do
|
||||||
case "$it" in
|
case "$it" in
|
||||||
-p | --printresult | --parallel | --target=* )
|
-p | --printresult | --parallel | --target=* | --newlines=on | --newlines=off )
|
||||||
if test "${args#*$it}" = "$args"; then
|
if test "${args#*$it}" = "$args"; then
|
||||||
newArgs "$it"
|
newArgs "$it"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue