release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since 19cc7b00 was
d4ecc78,
checked in by David Benjamin <davidben@mit.edu>, 14 years ago
|
Complete color names for filters
This will likely have to be changed later, but for now, it's something.
Signed-off-by: David Benjamin <davidben@mit.edu>
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[f80ada8] | 1 | use strict; |
---|
| 2 | use warnings; |
---|
| 3 | |
---|
| 4 | # Completers for client state |
---|
| 5 | |
---|
| 6 | package BarnOwl::Complete::Client; |
---|
| 7 | |
---|
| 8 | use BarnOwl::Completion::Util qw(complete_flags); |
---|
| 9 | |
---|
[d4ecc78] | 10 | my @all_colors = qw(default |
---|
| 11 | black |
---|
| 12 | blue |
---|
| 13 | cyan |
---|
| 14 | green |
---|
| 15 | magenta |
---|
| 16 | red |
---|
| 17 | white |
---|
| 18 | yellow); |
---|
| 19 | |
---|
[f80ada8] | 20 | sub complete_command { return sort @BarnOwl::all_commands; } |
---|
[d4ecc78] | 21 | sub complete_color { return @all_colors; } |
---|
[f80ada8] | 22 | |
---|
| 23 | sub complete_help { |
---|
| 24 | my $ctx = shift; |
---|
| 25 | return complete_flags($ctx, |
---|
| 26 | [qw()], |
---|
| 27 | { |
---|
| 28 | }, |
---|
| 29 | \&complete_command |
---|
| 30 | ); |
---|
| 31 | } |
---|
| 32 | |
---|
[d4ecc78] | 33 | sub complete_filter { |
---|
| 34 | my $ctx = shift; |
---|
| 35 | return complete_flags($ctx, |
---|
| 36 | [qw()], |
---|
| 37 | { |
---|
| 38 | "-c" => \&complete_color, |
---|
| 39 | "-b" => \&complete_color, |
---|
| 40 | }, |
---|
| 41 | undef # TODO: make this get list of filters for the first argument |
---|
| 42 | # then maybe some magic like completing keywords instance and other shiny |
---|
| 43 | ); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | BarnOwl::Completion::register_completer(help => \&complete_help); |
---|
| 47 | BarnOwl::Completion::register_completer(filter => \&complete_filter); |
---|
[f80ada8] | 48 | |
---|
| 49 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.