From 31115dd3122a1994a83f59f4be485a814d1a1f41 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 25 Nov 2016 20:00:27 +0100 Subject: [PATCH] Print compile options (window, drun,timing, asan, gcov) in -help Issue: #506 --- .github/CONTRIBUTING.md | 2 +- .github/ISSUE_TEMPLATE.md | 2 +- configure.ac | 3 ++- include/rofi.h | 2 ++ source/rofi.c | 34 +++++++++++++++++++++++++++++++--- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a1366b8f..b5c6408e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -14,7 +14,7 @@ Before creating an issue: When reporting bugs include the following information: * Rofi version. rofi -v -* Rofi configuration. rofi -dump-xresources (in a [gist](https://gist.github.com/)) +* Rofi configuration. rofi -help (in a [gist](https://gist.github.com/)) * Steps to reproduce. * What behaviour you see. * What behaviour you expect to see. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index cfc2a443..5eac0df8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -5,7 +5,7 @@ Output of `rofi -v` ## Configuration -Output of `rofi -dump-xresources` (in a [gist](https://gist.github.com/)) +Output of `rofi -help` (in a [gist](https://gist.github.com/)) ## Launch Command diff --git a/configure.ac b/configure.ac index ec403685..c07b0f72 100644 --- a/configure.ac +++ b/configure.ac @@ -48,10 +48,11 @@ dnl --------------------------------------------------------------------- AC_ARG_ENABLE(gcov, [ --enable-gcov Enable source code coverage testing using gcov], [AM_CFLAGS="${AM_CFLAGS} -coverage"]) - +AS_IF([test "X${enable_gcov}" == "xyes" ], [AC_DEFINE([ENABLE_GCOV], [1], [Enable gcov profiling])]) AC_ARG_ENABLE(asan, [ --enable-asan asan], [AM_CFLAGS="${AM_CFLAGS} -fsanitize=address -fno-omit-frame-pointer -g3"]) +AS_IF([test "X${enable_asan}" == "xyes" ], [AC_DEFINE([ENABLE_ASAN], [1], [Enable libasan])]) dnl -------------------------------------------------------------------- diff --git a/include/rofi.h b/include/rofi.h index 8bd8e960..fad90e49 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -51,6 +51,8 @@ void rofi_set_return_code ( int code ); #define color_italic "\033[2m" /** Set terminal foreground text green */ #define color_green "\033[0;32m" +/** Set terminal foreground text red */ +#define color_red "\033[0;31m" /** Appends instructions on how to report an error. */ #define ERROR_MSG( a ) a "\n" \ diff --git a/source/rofi.c b/source/rofi.c index c33bedba..f7b7160b 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -236,9 +236,8 @@ void process_result ( RofiViewState *state ) /** * Help function. */ -static void print_main_application_options ( void ) +static void print_main_application_options ( int is_term ) { - int is_term = isatty ( fileno ( stdout ) ); print_help_msg ( "-no-config", "", "Do not load configuration, use default values.", NULL, is_term ); print_help_msg ( "-v,-version", "", "Print the version number and exit.", NULL, is_term ); print_help_msg ( "-dmenu", "", "Start in dmenu mode.", NULL, is_term ); @@ -253,16 +252,45 @@ static void print_main_application_options ( void ) } static void help ( G_GNUC_UNUSED int argc, char **argv ) { + int is_term = isatty ( fileno ( stdout ) ); printf ( "%s usage:\n", argv[0] ); printf ( "\t%s [-options ...]\n\n", argv[0] ); printf ( "Command line only options:\n" ); - print_main_application_options (); + print_main_application_options ( is_term ); printf ( "DMENU command line options:\n" ); print_dmenu_options (); printf ( "Global options:\n" ); print_options (); printf ( "\n" ); x11_dump_monitor_layout (); + printf ( "\n" ); + printf ( "Compile time options:\n"); +#ifdef WINDOW_MODE + printf ( "\t* window %senabled%s\n", is_term?color_green:"", is_term?color_reset:""); +#else + printf ( "\t* window %sdisabled%s\n", is_term?color_red:"", is_term?color_reset:""); +#endif +#ifdef ENABLE_DRUN + printf ( "\t* drun %senabled%s\n", is_term?color_green:"", is_term?color_reset:""); +#else + printf ( "\t* drun %sdisabled%s\n", is_term?color_red:"", is_term?color_reset:""); +#endif +#ifdef TIMINGS + printf ( "\t* timings %senabled%s\n", is_term?color_green:"", is_term?color_reset:""); +#else + printf ( "\t* timings %sdisabled%s\n", is_term?color_red:"", is_term?color_reset:""); +#endif +#ifdef ENABLE_GCOV + printf ( "\t* gcov %senabled%s\n", is_term?color_green:"", is_term?color_reset:""); +#else + printf ( "\t* gcov %sdisabled%s\n", is_term?color_red:"", is_term?color_reset:""); +#endif +#ifdef ENABLE_ASAN + printf ( "\t* asan %senabled%s\n", is_term?color_green:"", is_term?color_reset:""); +#else + printf ( "\t* asan %sdisabled%s\n", is_term?color_red:"", is_term?color_reset:""); +#endif + printf ( "\n" ); printf ( "For more information see: man rofi\n" ); #ifdef GIT_VERSION printf ( "Version: "GIT_VERSION "\n" );