OPT_CONVERT,
OPT_INFORMAT,
OPT_OUTFORMAT,
+ OPT_OUTFORMAT_STR,
OPT_INFILE,
OPT_OUTFILE,
OPT_FORMATS
{ "convert", 0, 0, OPT_CONVERT },
{ "informat", 1, 0, OPT_INFORMAT },
{ "outformat", 1, 0, OPT_OUTFORMAT },
+ { "outformatstr", 1, 0, OPT_OUTFORMAT_STR },
{ "infile", 1, 0, OPT_INFILE },
{ "outfile", 1, 0, OPT_OUTFILE },
{ "formats", 0, 0, OPT_FORMATS },
outformat = optarg;
selected_item_filter = select_output_item_filter(outformat);
break;
+ case OPT_OUTFORMAT_STR:
+ strncpy(custom_format, optarg, FORMAT_STRING_LEN - 1);
+ custom_format[FORMAT_STRING_LEN] = 0;
+ break;
case OPT_INFILE:
set_convert_var(infile);
break;
if(! selected_item_filter.func)
selected_item_filter = select_output_item_filter("muttq");
+ else if (! strcmp(outformat, "custom") && *custom_format) {
+ parsed_custom_format = (char *)malloc(FORMAT_STRING_LEN * sizeof(char*));
+ custom_format_fields = (enum field_types *)malloc(FORMAT_STRING_MAX_FIELDS * sizeof(enum field_types *));
+ parse_custom_format(custom_format, parsed_custom_format, custom_format_fields);
+ }
if(optind < argc) {
fprintf(stderr, _("%s: unrecognized arguments on command line\n"),
argv[0]);
{ "wl", N_("Wanderlust address book"), wl_export_database },
{ "spruce", N_("Spruce address book"), spruce_export_database },
{ "bsdcal", N_("BSD calendar"), bsdcal_export_database },
+ { "custom", N_("Custom format"), custom_export_database },
{ "\0", NULL, NULL }
};
struct abook_output_item_filter u_filters[] = {
{ "muttq", N_("mutt alias"), muttq_print_item },
+ { "custom", N_("Custom format"), custom_print_item },
{ "\0", NULL }
};