Fix printing.

This commit is contained in:
Dave Davenport 2015-11-14 19:59:56 +01:00
parent 64eb7851e1
commit 2eaffceada
4 changed files with 27 additions and 27 deletions

View File

@ -52,5 +52,5 @@ void xresource_dump ( void );
*/
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
void print_options ( void );
void print_help_msg ( const char *option, const char*text, const char *def, int isatty );
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
#endif

View File

@ -399,15 +399,15 @@ int dmenu_switcher_dialog ( void )
void print_dmenu_options ( void )
{
int is_term = isatty ( fileno ( stdout ) );
print_help_msg ( "-mesg [string]", "Print a small user message under the prompt (uses pango markup)", NULL, is_term );
print_help_msg ( "-p [string]", "Prompt to display left of entry field", NULL, is_term );
print_help_msg ( "-selected-row [integer]", "Select row", NULL, is_term );
print_help_msg ( "-format [string]", "Output format string", "s", is_term );
print_help_msg ( "-u [list]", "List of row indexes to mark urgent", NULL, is_term );
print_help_msg ( "-a [list]", "List of row indexes to mark active", NULL, is_term );
print_help_msg ( "-l [integer] ", "Number of rows to display", NULL, is_term );
print_help_msg ( "-i", "Set filter to be case insensitive", NULL, is_term );
print_help_msg ( "-only-match", "Force selection or custom entry", NULL, is_term );
print_help_msg ( "-no-custom", "Don't accept custom entry", NULL, is_term );
print_help_msg ( "-select [string]", "Select the first row that matches", NULL, is_term );
print_help_msg ( "-mesg","[string]", "Print a small user message under the prompt (uses pango markup)", NULL, is_term );
print_help_msg ( "-p","[string]", "Prompt to display left of entry field", NULL, is_term );
print_help_msg ( "-selected-row","[integer]", "Select row", NULL, is_term );
print_help_msg ( "-format","[string]", "Output format string", "s", is_term );
print_help_msg ( "-u","[list]", "List of row indexes to mark urgent", NULL, is_term );
print_help_msg ( "-a","[list]", "List of row indexes to mark active", NULL, is_term );
print_help_msg ( "-l","[integer] ", "Number of rows to display", NULL, is_term );
print_help_msg ( "-i","", "Set filter to be case insensitive", NULL, is_term );
print_help_msg ( "-only-match","", "Force selection or custom entry", NULL, is_term );
print_help_msg ( "-no-custom","", "Don't accept custom entry", NULL, is_term );
print_help_msg ( "-select","[string]", "Select the first row that matches", NULL, is_term );
}

View File

@ -1834,17 +1834,17 @@ static void handle_keypress ( XEvent *ev )
static void print_main_application_options ( void )
{
int is_term = isatty ( fileno ( stdout ) );
print_help_msg ( "-no-config", "Do not load configuration, use default values.", NULL, is_term );
print_help_msg ( "-quiet", "Suppress information messages.", 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 );
print_help_msg ( "-display [string]", "X server to contact.", "${DISPLAY}", is_term );
print_help_msg ( "-h,-help", "This help message.", NULL, is_term );
print_help_msg ( "-dump-xresources", "Dump the current configuration in Xresources format and exit.", NULL, is_term );
print_help_msg ( "-e [string]", "Show a dialog displaying the passed message and exit.", NULL, is_term );
print_help_msg ( "-markup", "Enable pango markup where possible.", NULL, is_term );
print_help_msg ( "-normal-window", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term );
print_help_msg ( "-show [mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term );
print_help_msg ( "-no-config","", "Do not load configuration, use default values.", NULL, is_term );
print_help_msg ( "-quiet","", "Suppress information messages.", 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 );
print_help_msg ( "-display","[string]", "X server to contact.", "${DISPLAY}", is_term );
print_help_msg ( "-h,-help","", "This help message.", NULL, is_term );
print_help_msg ( "-dump-xresources","", "Dump the current configuration in Xresources format and exit.", NULL, is_term );
print_help_msg ( "-e","[string]", "Show a dialog displaying the passed message and exit.", NULL, is_term );
print_help_msg ( "-markup", "","Enable pango markup where possible.", NULL, is_term );
print_help_msg ( "-normal-window","", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term );
print_help_msg ( "-show", "[mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term );
}
static void help ( G_GNUC_UNUSED int argc, char **argv )
{

View File

@ -493,17 +493,17 @@ void print_options ( void )
}
}
void print_help_msg ( const char *option, const char*text, const char *def, int isatty )
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty )
{
int l = 39 - strlen ( option );
int l = 37 - strlen ( option )-strlen(type);
if ( isatty ) {
printf ( "\t%s%s%s %-*c%s\n", color_bold, option, color_reset, l, ' ', text );
printf ( "\t%s%s%s %s %-*c%s\n", color_bold, option, color_reset,type, l, ' ', text );
if ( def != NULL ) {
printf ( "\t\t%s%s%s\n", color_italic, def, color_reset );
}
}
else{
printf ( "\t%s %-*c%s\n", option, l, ' ', text );
printf ( "\t%s %s %-*c%s\n", option, type,l, ' ', text );
if ( def != NULL ) {
printf ( "\t\t%s\n", def );
}