diff options
author | Wincent Colaiuta <win@wincent.com> | 2007-12-03 09:09:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-03 01:04:28 -0800 |
commit | 7e018be2ada073c92da59eb41442cde22c0c2796 (patch) | |
tree | b30d0c9ff34bc986ec870f88a0bd9eb24690ae5a /git-add--interactive.perl | |
parent | 633209898b71df4cf4d9296f224294f9fe252f66 (diff) | |
download | git-7e018be2ada073c92da59eb41442cde22c0c2796.tar.gz |
git-add -i: add help text for list-and-choose UI
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-x | git-add--interactive.perl | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 32fb9ea2bb..335c2c6b56 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -237,7 +237,8 @@ sub is_valid_prefix { !($prefix =~ /[\s,]/) && # separators !($prefix =~ /^-/) && # deselection !($prefix =~ /^\d+/) && # selection - ($prefix ne '*'); # "all" wildcard + ($prefix ne '*') && # "all" wildcard + ($prefix ne '?'); # prompt help } # given a prefix/remainder tuple return a string with the prefix highlighted @@ -318,6 +319,12 @@ sub list_and_choose { } chomp $line; last if $line eq ''; + if ($line eq '?') { + $opts->{SINGLETON} ? + singleton_prompt_help_cmd() : + prompt_help_cmd(); + next TOPLOOP; + } for my $choice (split(/[\s,]+/, $line)) { my $choose = 1; my ($bottom, $top); @@ -363,6 +370,28 @@ sub list_and_choose { return @return; } +sub singleton_prompt_help_cmd { + print <<\EOF ; +Prompt help: +1 - select a numbered item +foo - select item based on unique prefix + - (empty) select nothing +EOF +} + +sub prompt_help_cmd { + print <<\EOF ; +Prompt help: +1 - select a single item +3-5 - select a range of items +2-3,6-9 - select multiple ranges +foo - select item based on unique prefix +-... - unselect specified items +* - choose all items + - (empty) finish selecting +EOF +} + sub status_cmd { list_and_choose({ LIST_ONLY => 1, HEADER => $status_head }, list_modified()); |