aboutsummaryrefslogtreecommitdiffstats
path: root/src/argparser.bash
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-23 21:35:27 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-23 21:35:27 +0200
commit4cafa7d686454309bdc7a63591133a88817c3719 (patch)
treeb2d1db39a1e9e8a0fa93f61e0921ffe5402cf9e8 /src/argparser.bash
parentissue 2, python version (diff)
downloadargparser-4cafa7d686454309bdc7a63591133a88817c3719.tar.gz
argparser-4cafa7d686454309bdc7a63591133a88817c3719.tar.bz2
argparser-4cafa7d686454309bdc7a63591133a88817c3719.tar.xz
m fix bash and java version
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/argparser.bash13
1 files changed, 8 insertions, 5 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