From 4585b123f563e2934545e3b5a5cd3fb1a0edaa66 Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 12 Oct 2006 19:22:33 +0000 Subject: now all admin commands can be accessed via firma --help command --- firma | 62 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 'firma') diff --git a/firma b/firma index 20ca56e..f1d2fd2 100755 --- a/firma +++ b/firma @@ -1095,6 +1095,7 @@ function ListAdministration { quit quit this prompt help show this help list show list subscribers + config list configuration info EMAIL-ADDRESS show info of a given subscriber sendkey SUBSCRIBER send list pubkey to subscriber subscribe [..] subscribe users ('subscribe help' for options) @@ -1121,17 +1122,21 @@ function ListAdministration { done ;; subscribe) - AdminLog "$1: missing arguments (try \"subscribe help\")" + AdminLog "$1: missing arguments (try \"$1 help\")" return_code=1 ;; sendkey) - AdminLog "$1: missing arguments (try \"sendkey help\")." + AdminLog "$1: missing arguments (try \"$1 help\")." return_code=1 ;; info) - AdminLog "$1: missing arguments (try \"info help\")." + AdminLog "$1: missing arguments (try \"help\")." return_code=1 ;; + config) + AdminLog "$1: missing arguments (try \"$1 help\")." + return_code=1 + ;; *) AdminLog "Command not found -- $1 (try \"help\")" return_code=1 @@ -1165,6 +1170,15 @@ function ListAdministration { GetSubscribersInfo $2 return_code=$? ;; + config) + if [ "$2" == "help" ]; then + ConfigHelp + return_code=$? + else + AdminLog "$1: too many arguments -- $@ (try \"$1 help\")" + return_code=1 + fi + ;; help|quit) AdminLog "$1: too many arguments -- $@ (try \"help\")" return_code=1 @@ -1998,6 +2012,26 @@ function SourceListConfig { REQUIRE_SIGNATURE="`EvalConfigParameter $LIST_CONFIG_FILE REQUIRE_SIGNATURE`" } + +function ConfigHelp { + #------------------------------------------------------------- + # display help on configuration file parameters + # + # parameter(s): none + # depends on function(s): SourceFirmaConfig, SourceListConfig + # returns: 0 + #------------------------------------------------------------- + + echo "All firma parameters are passed through two different configuration files:" + echo "firma.conf, containing general parameters needed to run the script, and a list" + echo "specific file, containing its address, administrator(s), etc. In both files" + echo "you should enter PARAMETER='value' (with value between single quotes, without" + echo "spaces before or after the equal sign and nothing after the second quote)." + + SourceFirmaConfig help + SourceListConfig help +} + #------------------------------------------------------------- # main() #------------------------------------------------------------- @@ -2079,7 +2113,8 @@ FUNCTIONS=" CreateMessageBodyPart EvalConfigParameter SourceFirmaConfig - SourceListConfig" + SourceListConfig + ConfigHelp" for VAR in $GLOBAL_VARS; do declare $VAR @@ -2209,19 +2244,12 @@ case $# in # valid option called with too many arguments -h|--help|-v|--version) if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then - if [ "$2" == "config" ]; then - echo "All firma parameters are passed through two different configuration files:" - echo "firma.conf, containing general parameters needed to run the script, and a list" - echo "specific file, containing its address, administrator(s), etc. In both files" - echo "you should enter PARAMETER='value' (without spaces before or after the equal sign)." - SourceFirmaConfig help - SourceListConfig help - EXIT_CODE=0 - else - echo >&2 "$(basename $0): too many arguments -- $@" - Usage - EXIT_CODE=1 - fi + ListAdministration $2 help + EXIT_CODE=$? + else + echo >&2 "$(basename $0): too many arguments -- $@" + Usage + EXIT_CODE=1 fi ;; *) -- cgit v1.2.3