AboutSummaryRefsLogTreeCommitDiffStats
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2015-07-21 17:23:32 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-05-07 11:32:19 +0200
commitcdd26d5b00a7472e7a235b473e5b3eeab5f905b9 (patch)
treed5dc5d25b7a424d8f5c8a9035e86d9ece817564c
parent8f136b3d67966a1a72cadd74fdad850e24797a4c (diff)
downloadmcron-cdd26d5b00a7472e7a235b473e5b3eeab5f905b9.tar.gz
mcron-cdd26d5b00a7472e7a235b473e5b3eeab5f905b9.tar.bz2
mcron-cdd26d5b00a7472e7a235b473e5b3eeab5f905b9.zip
main: Add 'show-help' procedure.
* scm/mcron/main.scm (show-help): New procedure.
-rw-r--r--scm/mcron/main.scm50
1 files changed, 22 insertions, 28 deletions
diff --git a/scm/mcron/main.scm b/scm/mcron/main.scm
index f5e9e3e..5f48379 100644
--- a/scm/mcron/main.scm
+++ b/scm/mcron/main.scm
@@ -148,17 +148,13 @@ General help using GNU software: <http://www.gnu.org/gethelp/>\n"
config-package-name
config-package-url))
-;; If the user asked for the help text of this program, give it to him and get
-;; out.
-
-(if (option-ref options 'help #f)
- (begin
- (display (string-append "
-Usage: " (car (command-line))
-(case command-type
-
- ((mcron)
-" [OPTIONS] [FILES]\n
+(define* (show-help #:optional (command command-name))
+ "Display informations of usage for COMMAND and quit."
+ (simple-format #t "Usage: ~a" command)
+ (display
+ (case command-type
+ ((mcron)
+ " [OPTIONS] [FILES]\n
Run an mcron process according to the specifications in the FILES (`-' for\n
standard input), or use all the files in ~/.config/cron (or the \n
deprecated ~/.cron) with .guile or .vixie extensions.\n
@@ -170,9 +166,8 @@ deprecated ~/.cron) with .guile or .vixie extensions.\n
and run as a daemon process\n
-i, --stdin=(guile|vixie) Format of data passed as standard input or\n
file arguments (default guile)")
-
- ((cron)
-" [OPTIONS]\n
+ ((cron)
+ " [OPTIONS]\n
Unless an option is specified, run a cron daemon as a detached process, \n
reading all the information in the users' crontabs and in /etc/crontab.\n
\n
@@ -181,21 +176,20 @@ reading all the information in the users' crontabs and in /etc/crontab.\n
-sN, --schedule[=]N Display the next N jobs that will be run by cron\n
-n, --noetc Do not check /etc/crontab for updates (HIGHLY\n
RECOMMENDED).")
-
- ((crontab)
- (string-append " [-u user] file\n"
- " " (car (command-line)) " [-u user] { -e | -l | -r }\n"
- " (default operation is replace, per 1003.2)\n"
- " -e (edit user's crontab)\n"
- " -l (list user's crontab)\n"
- " -r (delete user's crontab)\n"))
-
- (else "rubbish"))))
- (newline)
- (show-package-information)
- (quit)))
-
+ ((crontab)
+ " [-u user] file\n
+ crontab [-u user] { -e | -l | -r }\n
+ (default operation is replace, per 1003.2)\n
+ -e (edit user's crontab)\n
+ -l (list user's crontab)\n
+ -r (delete user's crontab")
+ (else "\nrubbish")))
+ (newline)
+ (show-package-information)
+ (quit))
+(when (option-ref options 'help #f)
+ (show-help))
;; This is called from the C front-end whenever a terminal signal is
;; received. We remove the /var/run/cron.pid file so that crontab and other