Open KenYN opened 5 years ago
Let me rephrase to see whether we are on the same page:
You would basically like to have the generated parsing code in an external file, but you would like to have declarations in the script itself, as they are the natural place where you would expect them to be - the declarations should be in the file's top, whereas the actual code that uses variables produced by those declarations is at the bottom of the file.
Yes, basically that, so when I run argbash
on the main file it writes the parsing code to the INCLUDE_PARSING_CODE()
file (or whatever keyword would work) rather than placing it inline in the m4_ignore([])
block.
EDIT: I just noticed that argbash-init
generates printf
s for the variables:
printf "Value of '%s': %s\\n" 'foo_bar' "$_arg_foo_bar"
Similar but commented code when using argbash
would help, or a copy of body of the print_help()
function.
Currently my
main.sh
has something like:And
main.argbash
has:However, it means that anyone reading
main.sh
has to referencemain.argbash
to see what variables it provides, and I've found myself in the situation of referencing a variable that I'd deleted from the included file.So, it would be nice if either or both of (a) allow the
# ARG_...()
to be defined in the main file and/or (b) auto-add a reminder block to the main file like: