[pacman-dev] [PATCH] pacman/pacman-conf: -i/--is-set switch, returns 0 if option set
Returns 1 if option not set. Returns 1 with error to stderr if
flag does not exist. Case insensitive.
Signed-off-by: Matthew Sexton
On Tuesday, September 10, 2019 2:32:03 PM EDT you wrote:
Returns 1 if option not set. Returns 1 with error to stderr if flag does not exist. Case insensitive.
Signed-off-by: Matthew Sexton
--- src/pacman/pacman-conf.c | 44 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
Note: This patch is based off of my previous patch adding gettext localisation to pacman-conf. If attempting to apply this patch without that one first, the patch will most likely not apply.
On 9/10/19 2:32 PM, Matthew Sexton wrote:
Returns 1 if option not set. Returns 1 with error to stderr if flag does not exist. Case insensitive.
As discussed on IRC, it seems like this may be easier and more reliable to achieve by using exit statuses. Instead of exiting 1 on a missing flag, and returning 0 otherwise while printing out the key (or not)... Maybe emulate e.g. grep. Return 2 if an error occurred, i.e. missing option, and then even without -i, we can return 1 if the option is not set. -- Eli Schwartz Bug Wrangler and Trusted User
On 11/9/19 10:29 am, Eli Schwartz wrote:
On 9/10/19 2:32 PM, Matthew Sexton wrote:
Returns 1 if option not set. Returns 1 with error to stderr if flag does not exist. Case insensitive.
As discussed on IRC, it seems like this may be easier and more reliable to achieve by using exit statuses. Instead of exiting 1 on a missing flag, and returning 0 otherwise while printing out the key (or not)...
Maybe emulate e.g. grep. Return 2 if an error occurred, i.e. missing option, and then even without -i, we can return 1 if the option is not set.
How to handle multiple directives? e.g. pacman-conf SigLevel LogFile NoColor
participants (3)
-
Allan McRae
-
Eli Schwartz
-
Matthew Sexton