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>
This commit is contained in:
committed by
Junio C Hamano
parent
ea8681e3a4
commit
3168514e6b
@@ -1,7 +1,9 @@
|
|||||||
imap.folder::
|
imap.folder::
|
||||||
The folder to drop the mails into, which is typically the Drafts
|
The folder to drop the mails into, which is typically the Drafts
|
||||||
folder. For example: "INBOX.Drafts", "INBOX/Drafts" or
|
folder. For example: `INBOX.Drafts`, `INBOX/Drafts` or
|
||||||
"[Gmail]/Drafts". Required.
|
`[Gmail]/Drafts`. The IMAP folder to interact with MUST be specified;
|
||||||
|
the value of this configuration variable is used as the fallback
|
||||||
|
default value when the `--folder` option is not given.
|
||||||
|
|
||||||
imap.tunnel::
|
imap.tunnel::
|
||||||
Command used to set up a tunnel to the IMAP server through which
|
Command used to set up a tunnel to the IMAP server through which
|
||||||
|
|||||||
@@ -9,21 +9,23 @@ git-imap-send - Send a collection of patches from stdin to an IMAP folder
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git imap-send' [-v] [-q] [--[no-]curl]
|
'git imap-send' [-v] [-q] [--[no-]curl] [(--folder|-f) <folder>]
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
This command uploads a mailbox generated with 'git format-patch'
|
This command uploads a mailbox generated with `git format-patch`
|
||||||
into an IMAP drafts folder. This allows patches to be sent as
|
into an IMAP drafts folder. This allows patches to be sent as
|
||||||
other email is when using mail clients that cannot read mailbox
|
other email is when using mail clients that cannot read mailbox
|
||||||
files directly. The command also works with any general mailbox
|
files directly. The command also works with any general mailbox
|
||||||
in which emails have the fields "From", "Date", and "Subject" in
|
in which emails have the fields `From`, `Date`, and `Subject` in
|
||||||
that order.
|
that order.
|
||||||
|
|
||||||
Typical usage is something like:
|
Typical usage is something like:
|
||||||
|
|
||||||
git format-patch --signoff --stdout --attach origin | git imap-send
|
------
|
||||||
|
$ git format-patch --signoff --stdout --attach origin | git imap-send
|
||||||
|
------
|
||||||
|
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
@@ -37,6 +39,11 @@ OPTIONS
|
|||||||
--quiet::
|
--quiet::
|
||||||
Be quiet.
|
Be quiet.
|
||||||
|
|
||||||
|
-f <folder>::
|
||||||
|
--folder=<folder>::
|
||||||
|
Specify the folder in which the emails have to saved.
|
||||||
|
For example: `--folder=[Gmail]/Drafts` or `-f INBOX/Drafts`.
|
||||||
|
|
||||||
--curl::
|
--curl::
|
||||||
Use libcurl to communicate with the IMAP server, unless tunneling
|
Use libcurl to communicate with the IMAP server, unless tunneling
|
||||||
into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
|
into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
|
||||||
|
|||||||
@@ -46,12 +46,14 @@
|
|||||||
|
|
||||||
static int verbosity;
|
static int verbosity;
|
||||||
static int use_curl = USE_CURL_DEFAULT;
|
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[] = {
|
static struct option imap_send_options[] = {
|
||||||
OPT__VERBOSITY(&verbosity),
|
OPT__VERBOSITY(&verbosity),
|
||||||
OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
|
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()
|
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);
|
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)
|
if (argc)
|
||||||
usage_with_options(imap_send_usage, imap_send_options);
|
usage_with_options(imap_send_usage, imap_send_options);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user