Improve scripts/bash-completion.sh and the command line arguments a bit.
This commit is contained in:
parent
3ea7d384e0
commit
fe8be54005
|
@ -5,11 +5,11 @@ _ybconAutoComplete() {
|
|||
COMPREPLY=()
|
||||
current="${COMP_WORDS[COMP_CWORD]}"
|
||||
previous="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
options="-p --help --printresult"
|
||||
if [[ ${current} == -* ]]; then
|
||||
COMPREPLY=( "$(compgen -W "$options" -- "$current")" )
|
||||
options='--help --printresult -p'
|
||||
if [[ "${current}" == -* ]]; then
|
||||
COMPREPLY=("$(compgen -W "$options" -- "$current")")
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _ybconAutoComplete ybcon
|
||||
complete -o nospace -F _ybconAutoComplete ybcon
|
|
@ -8,9 +8,9 @@ EXENAME=ybcon
|
|||
defaultBinLocation=/opt/bin/ybcon
|
||||
|
||||
usage() {
|
||||
echo "$EXENAME [-h|--help] [-p|-printresult] file"
|
||||
echo "$EXENAME [-h|--help] [-p|--printresult] file"
|
||||
echo " -h or --help What you're seeing right now"
|
||||
echo " -p or -printresult Prints the transpilation result to stdout"
|
||||
echo " -p or --printresult Prints the transpilation result to stdout"
|
||||
}
|
||||
|
||||
args="";
|
||||
|
@ -32,7 +32,7 @@ if [ "$#" != 0 ]; then
|
|||
echo "Usage:"
|
||||
usage
|
||||
exit 0 ;;
|
||||
-p | -printresult )
|
||||
-p | --printresult )
|
||||
newArgs "$it"
|
||||
shift ;;
|
||||
*.ybcon )
|
||||
|
|
|
@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
|
|||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
currentArg = ((string) argv[i]);
|
||||
if ((currentArg == "-printresult") || (currentArg == "-p")) printResult = true;
|
||||
if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true;
|
||||
else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9);
|
||||
}
|
||||
const string parsedString = parseString(make_unique<string>(getFileContent(fileName)));
|
||||
|
|
Loading…
Reference in New Issue