release-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
|
Last change
on this file since f907cf0 was
4fde21c,
checked in by Nelson Elhage <nelhage@mit.edu>, 17 years ago
|
|
Completion: complete filter names
|
-
Property mode set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 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 | |
|---|
| 10 | my @all_colors = qw(default |
|---|
| 11 | black |
|---|
| 12 | blue |
|---|
| 13 | cyan |
|---|
| 14 | green |
|---|
| 15 | magenta |
|---|
| 16 | red |
|---|
| 17 | white |
|---|
| 18 | yellow); |
|---|
| 19 | |
|---|
| 20 | sub complete_command { return sort @BarnOwl::all_commands; } |
|---|
| 21 | sub complete_color { return @all_colors; } |
|---|
| 22 | |
|---|
| 23 | sub complete_filter_args { |
|---|
| 24 | my $ctx = shift; |
|---|
| 25 | my $arg = shift; |
|---|
| 26 | return if $arg; |
|---|
| 27 | return @{BarnOwl::all_filters()}; |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | sub complete_help { |
|---|
| 31 | my $ctx = shift; |
|---|
| 32 | return complete_flags($ctx, |
|---|
| 33 | [qw()], |
|---|
| 34 | { |
|---|
| 35 | }, |
|---|
| 36 | \&complete_command |
|---|
| 37 | ); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | sub complete_filter { |
|---|
| 41 | my $ctx = shift; |
|---|
| 42 | return complete_flags($ctx, |
|---|
| 43 | [qw()], |
|---|
| 44 | { |
|---|
| 45 | "-c" => \&complete_color, |
|---|
| 46 | "-b" => \&complete_color, |
|---|
| 47 | }, |
|---|
| 48 | \&complete_filter_args |
|---|
| 49 | ); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | BarnOwl::Completion::register_completer(help => \&complete_help); |
|---|
| 53 | BarnOwl::Completion::register_completer(filter => \&complete_filter); |
|---|
| 54 | |
|---|
| 55 | 1; |
|---|
Note: See
TracBrowser
for help on using the repository browser.