diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argparser.bash | 13 | ||||
-rw-r--r-- | src/argparser/ArgParser.java | 8 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/argparser.bash b/src/argparser.bash index c828360..72567a6 100644 --- a/src/argparser.bash +++ b/src/argparser.bash @@ -676,17 +676,20 @@ function args_parse if [ $argnull = 0 ]; then arg="${argqueue[$i]}" fi + std="$(head -n 1 < "${args_optmap}/${opt}")" + trigger="$(tail -n 1 < "${args_optmap}/${opt}")" + if (( ${#argqueue[@]} <= $i )); then + "$trigger" "${opt}" "${std}" + fi (( i++ )) - opt="$(head -n 1 < "${args_optmap}/${opt}")" + opt="${std}" if [ ! -e "${args_opts}/${opt}" ]; then mkdir -p "${args_opts}/${opt}" echo -n > "${args_opts}/${opt}/data" echo -n > "${args_opts}/${opt}/null" fi - if (( ${#argqueue[@]} >= $i )); then - echo "$arg" >> "${args_opts}/${opt}/data" - echo "$argnull" >> "${args_opts}/${opt}/null" - fi + echo "$arg" >> "${args_opts}/${opt}/data" + echo "$argnull" >> "${args_opts}/${opt}/null" done i=0 diff --git a/src/argparser/ArgParser.java b/src/argparser/ArgParser.java index 931e79f..fd97f81 100644 --- a/src/argparser/ArgParser.java +++ b/src/argparser/ArgParser.java @@ -1163,13 +1163,15 @@ public class ArgParser int i = 0, n = optqueue.size(); while (i < n) { - final String opt = this.optmap.get(optqueue.get(i)).standard; + final Option option = this.optmap.get(optqueue.get(i)); + final String opt = option.standard; final String arg = argqueue.size() > i ? argqueue.get(i) : null; + if (len(argqueue) <= i) + option.trigger(optqueue.get(i), null); i++; if (this.opts.get(opt) == null) this.opts.put(opt, new String[] {}); - if (argqueue.size() >= i) - this.opts.put(opt, append(this.opts.get(opt), arg)); + this.opts.put(opt, append(this.opts.get(opt), arg)); } for (final Option opt : this.options) |