From d60dae8066b7965df66ba68f9f98ea1222b4fc49 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 20 May 2013 19:29:58 +0200 Subject: [PATCH] Improve man page layout. This changes the output of --help, --detailed-help and --version so that the man pages generated from this output by help2man look much nicer. Specifically, name and purposes are printed in a single line and the version text now contains also build data, build system and the compiler version. Also the codename is no longer printed in version_single_line(), since this caused the top and bottom labels of the man pages to look quite ugly. --- ggo.c | 6 ++---- ggo.h | 8 +++----- version.c | 8 +++++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ggo.c b/ggo.c index 3a441db1..58d86d07 100644 --- a/ggo.c +++ b/ggo.c @@ -39,10 +39,8 @@ void ggo_print_help(struct ggo_help *help, unsigned flags) { const char **p; - if (flags & GPH_PRINT_NAME_VERSION) - printf_or_die("%s\n", version_single_line(help->prefix)); - if (help->purpose && (flags & GPH_PRINT_PURPOSE)) - printf_or_die("\n%s\n", help->purpose); + if (help->purpose && (flags & GPH_PRINT_NAME_PURPOSE)) + printf_or_die("para_%s - %s\n", help->prefix, help->purpose); if (help->usage && (flags & GPH_PRINT_USAGE)) printf_or_die("\n%s\n", help->usage); if (help->description && (flags & GPH_PRINT_DESCRIPTION)) diff --git a/ggo.h b/ggo.h index 671fc01c..81565e7c 100644 --- a/ggo.h +++ b/ggo.h @@ -33,19 +33,17 @@ struct ggo_help { enum ggo_print_help_flags { /** Whether to print the short help or the detailed help. */ GPH_DETAILED = 1 << 0, - /** Print the program or module name, git version and codename. */ - GPH_PRINT_NAME_VERSION = 1 << 1, + /** Print the program or module name and the purpose text. */ + GPH_PRINT_NAME_PURPOSE = 1 << 1, /** Print the synopsis. */ GPH_PRINT_USAGE = 1 << 2, /** Print the description text. */ GPH_PRINT_DESCRIPTION = 1 << 3, - /** Print the purpose text. */ - GPH_PRINT_PURPOSE = 1 << 4, }; /** Used to print the normal help of programs (--help) */ #define GPH_STANDARD_FLAGS \ - (GPH_PRINT_NAME_VERSION | GPH_PRINT_PURPOSE | GPH_PRINT_USAGE) + (GPH_PRINT_NAME_PURPOSE | GPH_PRINT_USAGE) /** Additional information for --detailed-help. */ #define GPH_STANDARD_FLAGS_DETAILED \ diff --git a/version.c b/version.c index d2df4818..ad133463 100644 --- a/version.c +++ b/version.c @@ -27,7 +27,7 @@ const char *version_single_line(const char *pfx) { static char buf[100]; snprintf(buf, sizeof(buf) - 1, - "para_%s " GIT_VERSION " (" CODENAME ")", pfx); + "para_%s " GIT_VERSION, pfx); return buf; } @@ -48,11 +48,13 @@ const char *version_text(const char *pfx) static char buf[512]; snprintf(buf, sizeof(buf) - 1, "%s\n" - "built: " BUILD_DATE ", " UNAME_RS ", " CC_VERSION "\n" "Copyright (C) 2013 Andre Noll\n" "This is free software with ABSOLUTELY NO WARRANTY." " See COPYING for details.\n" - "Report bugs to .\n", + "Report bugs to .\n" + "build date: " BUILD_DATE ",\n" + "build system: " UNAME_RS ",\n" + "compiler: " CC_VERSION ".\n", version_single_line(pfx) ); return buf; -- 2.39.2