From 62204d480ee54573025d3c251ec2f96b1258eb5b Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Wed, 20 Oct 2021 17:26:39 +0200 Subject: [PATCH] Support "--newlines=on/off" and "--buildInfo" in the shell scripts --- scripts/completions/bash-completion.sh | 2 +- scripts/completions/fish-completion.fish | 2 ++ scripts/completions/zsh-completion.zsh | 2 ++ scripts/ybcon | 8 +++++--- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/completions/bash-completion.sh b/scripts/completions/bash-completion.sh index bc093da..520c8c5 100644 --- a/scripts/completions/bash-completion.sh +++ b/scripts/completions/bash-completion.sh @@ -8,7 +8,7 @@ _ybconAutoComplete() { COMPREPLY=() current="${COMP_WORDS[COMP_CWORD]}" 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 YCompReply "$(compgen -W "$options" -- "$current")" return 0 diff --git a/scripts/completions/fish-completion.fish b/scripts/completions/fish-completion.fish index cd96902..453d265 100644 --- a/scripts/completions/fish-completion.fish +++ b/scripts/completions/fish-completion.fish @@ -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 -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 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 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" \ No newline at end of file diff --git a/scripts/completions/zsh-completion.zsh b/scripts/completions/zsh-completion.zsh index 02dddfe..9c05154 100644 --- a/scripts/completions/zsh-completion.zsh +++ b/scripts/completions/zsh-completion.zsh @@ -4,8 +4,10 @@ _ybcon() { _arguments \ '( - 0)'{-h,--help}'[Print the help screen]' \ '( - 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]' \ --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]' \ "*:$completeyfile" return 0 diff --git a/scripts/ybcon b/scripts/ybcon index 144bcbd..e1f4309 100755 --- a/scripts/ybcon +++ b/scripts/ybcon @@ -11,12 +11,14 @@ defaultBinLocation="$scriptDir/../libexec/ybcon" usage() { if [ "$1" = false ]; then echo "Invalid arguments, usage:"; fi - echo "$EXENAME [--version] [-h|--help] [--parallel] [--target=] [-p|--printresult] " + echo "$EXENAME [--version] [--buildInfo] [-h|--help] [--parallel] [--target=] [--newlines=on/off] [-p|--printresult] " if [ "$1" = true ]; then 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 " --parallel Transpile files in parallel mode" echo " --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" printf "\n" fi @@ -43,7 +45,7 @@ if [ "$#" != 0 ]; then case "$1" in -h | --help ) helpExit ;; - --version ) + --version | --buildInfo ) run=true; args="$1" ;; *.ybcon ) newArgs "$1"; run=true ;; @@ -54,7 +56,7 @@ if [ "$#" != 0 ]; then for it in "$@" do case "$it" in - -p | --printresult | --parallel | --target=* ) + -p | --printresult | --parallel | --target=* | --newlines=on | --newlines=off ) if test "${args#*$it}" = "$args"; then newArgs "$it" else