t/README: change "Inside <X> part" to "Inside the <X> part"
[alt-git.git] / builtin / interpret-trailers.c
blob175f14797b101d22ead9d1008744440da66a7c1c
1 /*
2 * Builtin "git interpret-trailers"
4 * Copyright (c) 2013, 2014 Christian Couder <chriscool@tuxfamily.org>
6 */
8 #include "cache.h"
9 #include "builtin.h"
10 #include "parse-options.h"
11 #include "string-list.h"
12 #include "trailer.h"
14 static const char * const git_interpret_trailers_usage[] = {
15 N_("git interpret-trailers [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"),
16 NULL
19 int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
21 int in_place = 0;
22 int trim_empty = 0;
23 struct string_list trailers = STRING_LIST_INIT_NODUP;
25 struct option options[] = {
26 OPT_BOOL(0, "in-place", &in_place, N_("edit files in place")),
27 OPT_BOOL(0, "trim-empty", &trim_empty, N_("trim empty trailers")),
28 OPT_STRING_LIST(0, "trailer", &trailers, N_("trailer"),
29 N_("trailer(s) to add")),
30 OPT_END()
33 argc = parse_options(argc, argv, prefix, options,
34 git_interpret_trailers_usage, 0);
36 if (argc) {
37 int i;
38 for (i = 0; i < argc; i++)
39 process_trailers(argv[i], in_place, trim_empty, &trailers);
40 } else {
41 if (in_place)
42 die(_("no input file given for in-place editing"));
43 process_trailers(NULL, in_place, trim_empty, &trailers);
46 string_list_clear(&trailers, 0);
48 return 0;