matejak / argbash

Bash argument parsing code generator
Other
1.4k stars 62 forks source link

Remove the dependency of DEFINE_LOAD_LIBRARY on DEFINE_SCRIPT_DIR #148

Open felipecrs opened 3 years ago

felipecrs commented 3 years ago

Currently, if you set DEFINE_LOAD_LIBRARY without DEFINE_SCRIPT_DIR, it will fail with:

❯ argbash -i pipeline/scripts/get_version_from_registry.sh
stdin:38: error: You have to define a script directory by some means before using 'DEFINE_LOAD_LIBRARY'
stdin:38: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
Error during autom4te run, aborting!

Argbash could handle this case, by making the DEFINE_LOAD_LIBRARY not use the $script_dir variable, in case it was not set. If set, then it would be good to reuse.

This is useful because, in 80% of the cases (I believe), the use of the $script_dir variable is just for importing a library.