summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-04-03 22:49:04 +0200
committerWerner Koch <wk@gnupg.org>2020-04-03 22:49:04 +0200
commit98d11eff669c042d381ee4f18a42d32bcab256ef (patch)
tree5c431bd7937e91e99c0b2570e00ec2122c805eb9 /tests
parentef07aedc70992742fcef92811345670777a3047b (diff)
downloadlibgpg-error-98d11eff669c042d381ee4f18a42d32bcab256ef.tar.gz
core: Improve the echo and info meta commands of the arg parser
* src/argparse.c (handle_meta_echo): Substitue some vars. (handle_meta_user): Factor some code out to ... (assure_username): new. -- Yeah, that is not really needed but might sometimes be helpful. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/etc/t-argparse.conf11
-rw-r--r--tests/t-argparse.conf2
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/etc/t-argparse.conf b/tests/etc/t-argparse.conf
index 4562c7c..863f74e 100644
--- a/tests/etc/t-argparse.conf
+++ b/tests/etc/t-argparse.conf
@@ -3,10 +3,17 @@
# Options applied to all user's config files
#verbose
-# The meta comman decho simply prints the argument. With a hash
+
+# The meta command echo simply prints the argument. With a hash
# prefix it does not prepend the file name and line number. For
# future compatibility do not use doallar signs.
[-echo Begin global config]
+
+[-echo use $${user} to echo the current user (${user})]
+[-echo use $${file} to echo the current file (${file})]
+[-echo use $${line} to echo the current line (${line})]
+[-echo use $${epoch} to echo a timestamp (${epoch})]
+
[verbose]
[user joy]
@@ -16,7 +23,7 @@
# info is an alias for echo but only executed if a user secion is active.
# For future compatibility do not use percent or dollar signs.
-[-info In user Joy]
+[-info In user Joy but real user id ${user}]
[-verbose]
[+force]
diff --git a/tests/t-argparse.conf b/tests/t-argparse.conf
index c689a63..f50712e 100644
--- a/tests/t-argparse.conf
+++ b/tests/t-argparse.conf
@@ -1,6 +1,6 @@
# User test config file for t-argparse
-[-echo begin of user config]
+[-echo begin of user config (user=${user})]
[+verbose]
# Options applied to all user's config files
echo