2 * Another stupid program, this one parsing the headers of an
3 * email to figure out authorship and subject
11 static const char mailinfo_usage
[] =
12 "git mailinfo [-k | -b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] <msg> <patch> < mail >info";
14 int cmd_mailinfo(int argc
, const char **argv
, const char *prefix
)
16 const char *def_charset
;
20 /* NEEDSWORK: might want to do the optional .git/ directory
25 def_charset
= get_commit_output_encoding();
26 mi
.metainfo_charset
= def_charset
;
28 while (1 < argc
&& argv
[1][0] == '-') {
29 if (!strcmp(argv
[1], "-k"))
31 else if (!strcmp(argv
[1], "-b"))
32 mi
.keep_non_patch_brackets_in_subject
= 1;
33 else if (!strcmp(argv
[1], "-m") || !strcmp(argv
[1], "--message-id"))
34 mi
.add_message_id
= 1;
35 else if (!strcmp(argv
[1], "-u"))
36 mi
.metainfo_charset
= def_charset
;
37 else if (!strcmp(argv
[1], "-n"))
38 mi
.metainfo_charset
= NULL
;
39 else if (starts_with(argv
[1], "--encoding="))
40 mi
.metainfo_charset
= argv
[1] + 11;
41 else if (!strcmp(argv
[1], "--scissors"))
43 else if (!strcmp(argv
[1], "--no-scissors"))
45 else if (!strcmp(argv
[1], "--no-inbody-headers"))
46 mi
.use_inbody_headers
= 0;
48 usage(mailinfo_usage
);
53 usage(mailinfo_usage
);
57 status
= !!mailinfo(&mi
, argv
[1], argv
[2]);