You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sourcing the generated bash completion script results in error.
I have a m4 template that has a single command with no options. If I add an option argument (that I don't really need), the the generated completion script works.
The Error when sourcing the generated completion script
waboring@walt-dev2:~/tmp: $ source build/completion/run.sh
bash: build/completion/run.sh: line 17: syntax error near unexpected token `)'
bash: build/completion/run.sh: line 17: ` )'
Here are my scripts
The source run.m4
waboring@walt-dev2:~/tmp: $ cat run.m4
#!/bin/bash
#
# DEFINE_SCRIPT_DIR
# ARG_POSITIONAL_SINGLE([command],)
# ARG_TYPE_GROUP_SET([commands], [COMMAND], [command], [test,but], [index])
# ARG_USE_ENV([DEPLOYMENT_TYPE], [openstack], [The deployment type you want])
# ARG_HELP([<The general help message of my script>])
# ARGBASH_SET_INDENT([ ])
# ARGBASH_GO
# [ <-- needed because of Argbash
# printf "Value of '%s': %s\\n" 'command' "$_arg_command"
#
if [ "$_arg_quiet" = "on" ]; then
QUIET="-q"
fi
echo "TESTS"
# ] <-- needed because of Argbash
The generated completion script
waboring@walt-dev2:~/tmp: $ cat build/completion/run.sh
#!/bin/bash
# Put this file to /etc/bash_completion.d/run.sh_ENDL_()# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.8.0 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
_run_sh ()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
all_long_opts="--help "
all_short_opts="-h "
case "$prev" in
)
COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") )
return 0
;;
*)
case "$cur" in
--*)
COMPREPLY=( $(compgen -W "${all_long_opts}" -- "${cur}") )
return 0
;;
-*)
COMPREPLY=( $(compgen -W "${all_short_opts}" -- "${cur}") )
return 0
;;
*)
COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") )
return 0
;;
esac
esac
}
complete -F _run_sh run.sh
### END OF CODE GENERATED BY Argbash (sortof) ### ])
If I add an optional argument, then the completion works.
waboring@walt-dev2:~/tmp: $ cat run.m4
#!/bin/bash
#
# DEFINE_SCRIPT_DIR
# ARG_POSITIONAL_SINGLE([command],)
# ARG_OPTIONAL_SINGLE([bogus], , [I don't want this optional argument], [*])
# ARG_TYPE_GROUP_SET([commands], [COMMAND], [command], [test,but], [index])
# ARG_USE_ENV([DEPLOYMENT_TYPE], [openstack], [The deployment type you want])
# ARG_HELP([<The general help message of my script>])
# ARGBASH_SET_INDENT([ ])
# ARGBASH_GO
# [ <-- needed because of Argbash
# printf "Value of '%s': %s\\n" 'command' "$_arg_command"
#
if [ "$_arg_quiet" = "on" ]; then
QUIET="-q"
fi
echo "TEST"
# ] <-- needed because of Argbash
Here is the sourcing of the completion script:
waboring@walt-dev2:~/tmp: $ cat build/completion/run.sh
#!/bin/bash
# Put this file to /etc/bash_completion.d/run.sh_ENDL_()# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.8.0 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
_run_sh ()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
all_long_opts="--bogus --help "
all_short_opts="-h "
case "$prev" in
--bogus)
COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") )
return 0
;;
*)
case "$cur" in
--*)
COMPREPLY=( $(compgen -W "${all_long_opts}" -- "${cur}") )
return 0
;;
-*)
COMPREPLY=( $(compgen -W "${all_short_opts}" -- "${cur}") )
return 0
;;
*)
COMPREPLY=( $(compgen -o bashdefault -o default -- "${cur}") )
return 0
;;
esac
esac
}
complete -F _run_sh run.sh
### END OF CODE GENERATED BY Argbash (sortof) ### ])
waboring@walt-dev2:~/tmp: $ source build/completion/run.sh
waboring@walt-dev2:~/tmp: $
The text was updated successfully, but these errors were encountered:
Sourcing the generated bash completion script results in error.
I have a m4 template that has a single command with no options. If I add an option argument (that I don't really need), the the generated completion script works.
The Error when sourcing the generated completion script
Here are my scripts
The source run.m4
The generated completion script
If I add an optional argument, then the completion works.
Here is the sourcing of the completion script:
The text was updated successfully, but these errors were encountered: