From 41389abd5519854543d22105c979e82ec3f57a05 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 28 Jan 2016 08:55:54 +0100 Subject: args.c: Revise help/usage/version output Remove obsolete options from the help text, add new options, clean everything up, cut translatable strings into atomic chunks. Signed-off-by: Lukas Fleischer --- src/args.c | 119 +++++++++++++++++-------------------------------------------- 1 file changed, 33 insertions(+), 86 deletions(-) diff --git a/src/args.c b/src/args.c index d40b470..6a85885 100644 --- a/src/args.c +++ b/src/args.c @@ -82,19 +82,14 @@ enum { */ static void usage(void) { - const char *arg_usage = - _("Usage: calcurse [-g|-h|-v] [-an] [-t[num]] [-i] [-x[format]]\n" - " [-d |] [-s[date]] [-r[range]]\n" - " [-c] [-D] [-S] [--status]\n" - " [--read-only]\n"); - fputs(arg_usage, stdout); + printf("%s\n", _("usage: calcurse [--daemon|-F|-G|-g|-i|-Q|--status|-x[]]\n" + " [-c] [-D] [-h] [-q] [--read-only] [-v]\n" + " [--filter-*] [--format-*]")); } static void usage_try(void) { - const char *arg_usage_try = - _("Try 'calcurse -h' for more information.\n"); - fputs(arg_usage_try, stdout); + printf("%s\n", _("Try `calcurse -h` for more information.")); } /* @@ -102,22 +97,10 @@ static void usage_try(void) */ static void version_arg(void) { - const char *vtext = - _("\nCopyright (c) 2004-2015 calcurse Development Team.\n" - "This is free software; see the source for copying conditions.\n"); - - fprintf(stdout, _("Calcurse %s - text-based organizer\n"), - VERSION); - fputs(vtext, stdout); -} - -static void more_info(void) -{ - fputs(_("\nFor more information, type '?' from within Calcurse, " - "or read the manpage.\n"), stdout); - fputs(_("Mail feature requests and suggestions to .\n"), - stdout); - fputs(_("Mail bug reports to .\n"), stdout); + printf(_("calcurse %s -- text-based organizer\n"), VERSION); + putchar('\n'); + printf("%s\n", _("Copyright (c) 2004-2015 calcurse Development Team.")); + printf("%s\n", _("This is free software; see the source for copying conditions.")); } /* @@ -125,68 +108,32 @@ static void more_info(void) */ static void help_arg(void) { - const char *htext = - _("\nMiscellaneous:\n" - " -h, --help\n" - " print this help and exit.\n" - "\n -v, --version\n" - " print calcurse version and exit.\n" - "\n --status\n" - " display the status of running instances of calcurse.\n" - "\n --read-only\n" - " Don't save configuration nor appointments/todos. Use with care.\n" - "\nFiles:\n" - " -c , --calendar \n" - " specify the calendar to use (has precedence over '-D').\n" - "\n -D , --directory \n" - " specify the data directory to use.\n" - "\tIf not specified, the default directory is ~/.calcurse\n" - "\nNon-interactive:\n" - " -a, --appointment\n" - " print events and appointments for current day and exit.\n" - "\n -d , --day \n" - " print events and appointments for or upcoming days and" - "\n\texit. To specify both a starting date and a range, use the\n" - "\t'--startday' and the '--range' option.\n" - "\n -g, --gc\n" - " run the garbage collector for note files and exit. \n" - "\n -i , --import \n" - " import the icalendar data contained in . \n" - "\n -n, --next\n" - " print next appointment within upcoming 24 hours " - "and exit. Also given\n\tis the remaining time before this " - "next appointment.\n" - "\n -l , --limit \n" - " only print information regarding the next items. \n" - "\n -r[num], --range[=num]\n" - " print events and appointments for the [num] number of days" - "\n\tand exit. If no [num] is given, a range of 1 day is considered.\n" - "\n -s[date], --startday[=date]\n" - " print events and appointments from [date] and exit.\n" - "\tIf no [date] is given, the current day is considered.\n" - "\n -S, --search=\n" - " search for the given regular expression within events, appointments,\n" - "\tand todos description.\n" - "\n -t[num], --todo[=num]\n" - " print todo list and exit. If the optional number [num] is given,\n" - "\tthen only todos having a priority equal to [num] will be returned.\n" - "\tThe priority number must be between 1 (highest) and 9 (lowest).\n" - "\tIt is also possible to specify '0' for the priority, in which case\n" - "\tonly completed tasks will be shown.\n" - "\n -x[format], --export[=format]\n" - " export user data to the specified format. Events, appointments and\n" - "\ttodos are converted and echoed to stdout.\n" - "\tTwo possible formats are available: 'ical' and 'pcal'.\n" - "\tIf the optional argument format is not given, ical format is\n" - "\tselected by default.\n" - "\tnote: redirect standard output to export data to a file,\n" - "\tby issuing a command such as: calcurse --export > calcurse.dat\n"); - - fprintf(stdout, _("Calcurse %s - text-based organizer\n"), - VERSION); usage(); - fputs(htext, stdout); - more_info(); + putchar('\n'); + printf("%s\n", _("Operations in non-interactive mode:")); + printf("%s\n", _(" -F, --filter Read items, filter them, and write them back")); + printf("%s\n", _(" -G, --grep Grep items from the data files")); + printf("%s\n", _(" -Q, --query Print items in a given query range")); + putchar('\n'); + printf("%s\n", _("Note that -F, -G and -Q can be combined with filter options --filter-*\n" + "and formatting options --format-*. Consult the man page for details.")); + putchar('\n'); + printf("%s\n", _("Miscellaneous:")); + printf("%s\n", _(" -c, --calendar Specify the calendar data file to use")); + printf("%s\n", _(" --daemon Run notification daemon in the background")); + printf("%s\n", _(" -D, --directory Specify the data directory to use")); + printf("%s\n", _(" -g, --gc Run the garbage collector and exit")); + printf("%s\n", _(" -h, --help Show this help text and exit")); + printf("%s\n", _(" -i, --import Import iCal data from a file")); + printf("%s\n", _(" -q, --quiet Do not show system dialogs")); + printf("%s\n", _(" --read-only Do not save configuration or data files")); + printf("%s\n", _(" --status Display the status of running instances")); + printf("%s\n", _(" -v, --version Show version information and exit")); + printf("%s\n", _(" -x, --export [] Export items, valid formats: ical, pcal")); + putchar('\n'); + printf("%s\n", _("For more information, type '?' from within calcurse, or read the manpage.")); + printf("%s\n", _("Submit feature requests and suggestions to .")); + printf("%s\n", _("Submit bug reports to .")); } /* -- cgit v1.2.3-70-g09d2