Print compile options (window, drun,timing, asan, gcov) in -help

Issue: #506
This commit is contained in:
Dave Davenport 2016-11-25 20:00:27 +01:00
parent bb9f8af36f
commit 31115dd312
5 changed files with 37 additions and 6 deletions

View file

@ -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.

View file

@ -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

View file

@ -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 --------------------------------------------------------------------

View file

@ -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" \

View file

@ -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" );