From 141acfcc1bb611ec8b1bafd229bb34845feadd51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Droz?= Date: Tue, 30 Aug 2011 15:42:09 +0200 Subject: [PATCH] mutt-query (3/3): register the --mutt-query-format per-item filter and use it --- abook.c | 10 ++++++++-- filter.c | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/abook.c b/abook.c index 4ef136c..e9f8841 100644 --- a/abook.c +++ b/abook.c @@ -50,6 +50,8 @@ static void add_email(int); char *datafile = NULL; static char *rcfile = NULL; +struct abook_output_item_filter selected_item_filter; + bool alternative_datafile = FALSE; bool alternative_rcfile = FALSE; @@ -303,6 +305,7 @@ parse_command_line(int argc, char **argv) *infile = "-", *outfile = "-"; int c; + selected_item_filter = select_output_item_filter("muttq"); for(;;) { int option_index = 0; @@ -368,7 +371,8 @@ parse_command_line(int argc, char **argv) set_convert_var(informat); break; case OPT_OUTFORMAT: - set_convert_var(outformat); + outformat = optarg; + selected_item_filter = select_output_item_filter(outformat); break; case OPT_INFILE: set_convert_var(infile); @@ -384,6 +388,8 @@ parse_command_line(int argc, char **argv) } } + if(! selected_item_filter.func) + selected_item_filter = select_output_item_filter("muttq"); if(optind < argc) { fprintf(stderr, _("%s: unrecognized arguments on command line\n"), argv[0]); @@ -462,7 +468,7 @@ mutt_query(char *str) } putchar('\n'); while(i >= 0) { - muttq_print_item(stdout, i); + e_write_item(stdout, i, selected_item_filter.func); i = find_item(str, i + 1, search_fields); } } diff --git a/filter.c b/filter.c index 96fa9c2..2735331 100644 --- a/filter.c +++ b/filter.c @@ -103,6 +103,7 @@ struct abook_output_filter e_filters[] = { }; struct abook_output_item_filter u_filters[] = { + { "muttq", N_("mutt alias"), muttq_print_item }, { "\0", NULL } }; -- 2.39.2