Changeset 69c27e6
- Timestamp:
- Sep 30, 2009, 1:02:36 AM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 42ad917
- Parents:
- a3a9eb7
- git-author:
- David Benjamin <davidben@mit.edu> (09/23/09 01:07:46)
- git-committer:
- David Benjamin <davidben@mit.edu> (09/30/09 01:02:36)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Completion/Util.pm
r94ef58c r69c27e6 24 24 my $optsdone = 0; 25 25 26 my %flags_seen; 27 26 28 while($idx < $ctx->word) { 27 29 my $word = $ctx->words->[$idx]; … … 37 39 } elsif ($word =~ m{^-}) { 38 40 $word = "-" . substr($word, -1); 41 $flags_seen{$word} = 1; # record flag 39 42 $flag = $word if(exists $args->{$word}); 40 43 } else { … … 58 61 return; 59 62 } else { 60 return ($optsdone ? () : (@$no_args, keys %$args), 61 $default ? ($default->($ctx, $argct)) : ()); 63 my @opts = $optsdone ? () : (@$no_args, keys %$args); 64 # filter out flags we've seen if needbe 65 @opts = grep {!$flags_seen{$_}} @opts unless $options{repeat_flags}; 66 return (@opts, $default ? ($default->($ctx, $argct)) : ()); 62 67 } 63 68 } -
t/completion.t
re97c5d05 r69c27e6 204 204 205 205 test_complete('zwrite -c nelhage ', '', 206 [qw(-n -C -m - c -i -r -O nelhage asedeno geofft)]);206 [qw(-n -C -m -i -r -O nelhage asedeno geofft)]); 207 207 208 208 test_complete('zwrite -c nelhage ', '-', 209 [qw(-n -C -m - c -i -r -O nelhage asedeno geofft)]);209 [qw(-n -C -m -i -r -O nelhage asedeno geofft)]); 210 210 211 211 test_complete('zwrite -c nelhage -- ', '', … … 219 219 "-d" => sub {qw(some words for completing)}, 220 220 }, 221 sub {$_[1]}); 221 sub {$_[1]}, 222 repeat_flags => 1); 222 223 } 223 224
Note: See TracChangeset
for help on using the changeset viewer.