From: Eric Sunshine <sunshine@sunshineco.com>
To: "Keller, Jacob E" <jacob.e.keller@intel.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
"gitster@pobox.com" <gitster@pobox.com>,
"spearce@spearce.org" <spearce@spearce.org>,
"lee.marlow@gmail.com" <lee.marlow@gmail.com>,
"felipe.contreras@gmail.com" <felipe.contreras@gmail.com>,
"szeder@ira.uka.de" <szeder@ira.uka.de>,
"jacob.keller@gmail.com" <jacob.keller@gmail.com>
Subject: Re: [PATCH v2 1/2] sendemail: teach git-send-email to list aliases
Date: Tue, 17 Nov 2015 02:20:49 -0500 [thread overview]
Message-ID: <20151117072049.GA25414@flurp.local> (raw)
In-Reply-To: <1447719035.23262.17.camel@intel.com>
On Tue, Nov 17, 2015 at 12:10:35AM +0000, Keller, Jacob E wrote:
> On Mon, 2015-11-16 at 18:50 -0500, Eric Sunshine wrote:
> > It should be possible to extract the alias within the shell itself
> > without a separate process. For instance:
> >
> > read alias rest
> >
> > will leave the first token in $alias and the remainder of the line in
> > $rest, and it's all done within the shell process.
>
> I'll look into this :)
My reason for asking is concern about scripts possibly breaking if
someone comes along and wants to "fix" --dump-aliases to also dump
the alias expansions. One possibility is just to punt today and say
that when that feature is needed in the future, then that someone can
add a --verbose option to complement --dump-aliases which would emit
the alias expansions as well. One nice thing about punting at this
point is that we don't (today) have to define a format for the output
of the expansions. If we did want to think about it, one verbose,
non-ambiguous format would be to show the alias name on a line by
itself, and each expansion value on a line by itself indented by a
tab. For instance:
managers
bob
fred
devs
jane
john
> > Also, shouldn't --list-aliases (or --dump-aliases) be mutually
> > exclusive with many of the other options? New tests would check such
> > exclusivity as well.
>
> I am at a loss for how to do that correctly in the perl. Help would be
> appreciated here.
Since git-send-email.perl already configures GetOpt::Long with the
'pass_through' option, one possibility would be to invoke
GetOptions() once for --list-aliases (or --dump-aliases), and then
again for the normal options. Doing so may be a bit ugly; on the
other hand, it does indicate pretty clearly that --list-aliases is a
distinct "mode" of operation. On top of your patch, it might look
something like this:
--- 8< ---
diff --git a/git-send-email.perl b/git-send-email.perl
index ee14894..cada5ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -296,6 +296,12 @@ $SIG{INT} = \&signal_handler;
my $help;
my $rc = GetOptions("h" => \$help,
+ "list-aliases" => \$list_aliases);
+usage() unless $rc;
+die "--list-aliases incompatible with other options\n"
+ if !$help and $list_aliases and @ARGV;
+
+$rc = GetOptions(
"sender|from=s" => \$sender,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
@@ -349,7 +355,6 @@ my $rc = GetOptions("h" => \$help,
"force" => \$force,
"xmailer!" => \$use_xmailer,
"no-xmailer" => sub {$use_xmailer = 0},
- "list-aliases" => \$list_aliases,
);
usage() if $help;
--- 8< ---
Though, it may be overkill for this minor use-case.
next prev parent reply other threads:[~2015-11-17 7:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-15 20:22 [PATCH v2 1/2] sendemail: teach git-send-email to list aliases Jacob Keller
2015-11-15 20:22 ` [PATCH v2 2/2] completion: add support for completing email aliases Jacob Keller
2015-11-16 23:33 ` Eric Sunshine
2015-11-16 23:40 ` Keller, Jacob E
2015-11-16 23:30 ` [PATCH v2 1/2] sendemail: teach git-send-email to list aliases Eric Sunshine
2015-11-16 23:40 ` Keller, Jacob E
2015-11-16 23:50 ` Eric Sunshine
2015-11-16 23:56 ` Eric Sunshine
2015-11-17 0:09 ` Keller, Jacob E
2015-11-17 0:10 ` Keller, Jacob E
2015-11-17 7:20 ` Eric Sunshine [this message]
2015-11-17 8:25 ` Jacob Keller
2015-11-17 12:26 ` SZEDER Gábor
2015-11-17 16:27 ` Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151117072049.GA25414@flurp.local \
--to=sunshine@sunshineco.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=lee.marlow@gmail.com \
--cc=spearce@spearce.org \
--cc=szeder@ira.uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).