From 923e9f3642ab6c982c0195b366ceec85ce24007f Mon Sep 17 00:00:00 2001 From: B Stack Date: Fri, 3 Apr 2020 09:11:57 -0400 Subject: fix #5 cli: multiple problems Option -n now acts as a dry run. The man page -V option is documented correctly now. --- src/usr/bin/logout-manager-cli | 7 ++++++- src/usr/share/man/man1/logout-manager-cli.1.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/usr/bin/logout-manager-cli b/src/usr/bin/logout-manager-cli index c325db4..974fd4b 100755 --- a/src/usr/bin/logout-manager-cli +++ b/src/usr/bin/logout-manager-cli @@ -6,6 +6,7 @@ # Title: cli logout manager # Purpose: Feature completeness in this package # History: +# 2020-04-03 fix #5 -n does nothing # Usage: # logout-manager-cli # Reference: @@ -39,7 +40,7 @@ import lmlib def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) -logout_manager_cli_version="2020-03-10" +logout_manager_cli_version="2020-04-03" parser = argparse.ArgumentParser(description="run logout-manager commands using cli") parser.add_argument('action', help='which action to take',nargs='?', choices=('lock','logout','hibernate','shutdown','reboot')) @@ -49,6 +50,10 @@ parser.add_argument("-V","--version", action="version", version="%(prog)s " + lo args = parser.parse_args() +# handle -n +if args.dryrun: + os.environ["DRYRUN"] = "from-parameters" + # load configs # in cli, must happen after arparse to benefit from debug value config = lmlib.Initialize_config(os.environ['LOGOUT_MANAGER_CONF']) diff --git a/src/usr/share/man/man1/logout-manager-cli.1.md b/src/usr/share/man/man1/logout-manager-cli.1.md index a775770..d4cb02c 100644 --- a/src/usr/share/man/man1/logout-manager-cli.1.md +++ b/src/usr/share/man/man1/logout-manager-cli.1.md @@ -14,7 +14,7 @@ Use this interface to `logout-manager`(7) from the command line or in scripts. P -n Dryrun only! Do not take action. Useful with `hibernate` to determine if hibernate is allowed on this system. --V --verbose be verbose +-V --version Display version and exit # ACTIONS One action may be specified on the command line. See "ACTIONS" section of `logout-manager`(7) man page for a list of available actions. # AUTHOR -- cgit