[PATCH v5 0/3] send-email: shell completion improvements
- From
Thiago Perrotta <tbperrotta@gmail.com>
- Date
- Sep 24, 2021, 02:46 UTC
- Message-ID
- <20210924024606.20542-1-tbperrotta@gmail.com>
- In-Reply-To
- <87zgs34ccx.fsf@evledraar.gmail.com>
"git send-email" completion (bash, zsh) is inconsistent, its flags are split into both git-completion.bash and git-send-email.perl, and it only emits format-patch flags.
Make shell completion uniform, centralizing completion options on git-send-email.perl.
Make "git send-email --git-completion-helper" properly emit send-email specific options, generating them programmatically.
Additionally, update git-send-email(1) man page to explicitly mention format-patch options.
Differences from V4:
Incorporate Carlo Arenas' and Ævar Arnfjörð Bjarmason's suggestion to programatically generate the flags.
I tried to be concise whilst preserving readability, hopefully it's straightforward to parse the current implementation.
Reviewers of previous versions:
- Bagas Sanjaya - Carlo Arenas - Junio Hamano - Ævar Arnfjörð Bjarmason
Ævar wrote earlier:
> Note: using --in-reply-to to the previous version in "git format-patch" > helps keep track of the context.
Thanks for the heads up, I am slowly getting used to this email workflow, this is my first contribution. Hopefully I got it right this time.
> Isn't this just:
> my @params = <getopts list>; > GetOptions(@params);
Let me know if the regex approach I went with is OK. You seem to have suggested me to do something with the `GetOptions` module, but I'm afraid I only know the basics of Perl.
I tried to do something like `GetOptions($USAGE)` but it didn't quite work (clearly I have no idea how to do that :P). If you have something specific in mind, I'd appreciate if you could send a small patch back that I can incorporate. Otherwise, either way, the current regex approach isn't too horrible and seems to be reasonably reliable.
Thiago Perrotta (3): send-email: terminate --git-completion-helper with LF send-email: programmatically generate bash completions send-email docs: add format-patch options
Documentation/git-send-email.txt | 6 ++++-- contrib/completion/git-completion.bash | 11 +---------- git-send-email.perl | 21 +++++++++++++++++---- t/t9902-completion.sh | 3 +++ 4 files changed, 25 insertions(+), 16 deletions(-)
-- 2.33.0