From 98d11eff669c042d381ee4f18a42d32bcab256ef Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 3 Apr 2020 22:49:04 +0200 Subject: 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 --- tests/etc/t-argparse.conf | 11 +++++++++-- tests/t-argparse.conf | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3