diff options
| author | Aditya Garg <gargaditya08@live.com> | 2025-06-20 12:10:29 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-20 08:11:17 -0700 |
| commit | 3168514e6b72668d699ae192f6492cddb4eebb4a (patch) | |
| tree | 35a6d94a6c6b4e5bf0d637625da91327a9aa1491 /imap-send.c | |
| parent | ea8681e3a4ca579f03d8dfb7a425a2a9da4b3493 (diff) | |
| download | git-3168514e6b72668d699ae192f6492cddb4eebb4a.tar.gz | |
imap-send: enable specifying the folder using the command line
Some users may very often want to imap-send messages to a folder
other than the default set in the config. Add a command line
argument for the same.
While at it, fix minor mark-up inconsistencies in the existing
documentation text.
Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'imap-send.c')
| -rw-r--r-- | imap-send.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c index 54dab627d6..ccf7195fd7 100644 --- a/imap-send.c +++ b/imap-send.c @@ -46,12 +46,14 @@ static int verbosity; static int use_curl = USE_CURL_DEFAULT; +static char *opt_folder; -static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] < <mbox>", NULL }; +static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] [(--folder|-f) <folder>] < <mbox>", NULL }; static struct option imap_send_options[] = { OPT__VERBOSITY(&verbosity), OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"), + OPT_STRING('f', "folder", &opt_folder, "folder", "specify the IMAP folder"), OPT_END() }; @@ -1722,6 +1724,11 @@ int cmd_main(int argc, const char **argv) argc = parse_options(argc, (const char **)argv, "", imap_send_options, imap_send_usage, 0); + if (opt_folder) { + free(server.folder); + server.folder = xstrdup(opt_folder); + } + if (argc) usage_with_options(imap_send_usage, imap_send_options); |
