parse-options: support --git-completion-helper
commitb9d7f4b4dbebea34ca8d02be8889884fc3fb90c7
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 9 Feb 2018 11:01:40 +0000 (9 18:01 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Feb 2018 18:24:49 +0000 (9 10:24 -0800)
treeae3333a0252d28013a8494f35db91db26d8a567c
parent5be1f00a9a701532232f57958efab4be8c959a29
parse-options: support --git-completion-helper

This option is designed to be used by git-completion.bash. For many
simple cases, what we do in there is usually

    __gitcomp "lots of completion options"

which has to be manually updated when a new user-visible option is
added. With support from parse-options, we can write

    __gitcomp "$(git command --git-completion-helper)"

and get that list directly from the parser for free. Dangerous/Unpopular
options could be hidden with the new "NOCOMPLETE" flag.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c
parse-options.h