[Bps-public-commit] Path-Dispatcher branch, master, updated. 9e8bed8ad332b08dcf723c4b65e93c47662ebbfc

sartak at bestpractical.com sartak at bestpractical.com
Thu Dec 31 13:10:07 EST 2009


The branch, master has been updated
       via  9e8bed8ad332b08dcf723c4b65e93c47662ebbfc (commit)
      from  ed71124d3e1023ea5a52179bfb7b91a91da04c2f (commit)

Summary of changes:
 lib/Path/Dispatcher.pm |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 9e8bed8ad332b08dcf723c4b65e93c47662ebbfc
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Dec 31 13:09:58 2009 -0500

    Document Dispatcher->complete

diff --git a/lib/Path/Dispatcher.pm b/lib/Path/Dispatcher.pm
index 2fe0df1..2b27508 100644
--- a/lib/Path/Dispatcher.pm
+++ b/lib/Path/Dispatcher.pm
@@ -174,6 +174,20 @@ dispatch.
 The args are passed down directly into each rule codeblock. No other args are
 given to the codeblock.
 
+=head2 complete path -> strings
+
+Given a path, consult each rule for possible completions for the path. This is
+intended for tab completion. You can use it with L<Term::ReadLine> like so:
+
+    $term->Attribs->{completion_function} = sub {
+        my ($last_word, $line, $start) = @_;
+        my @matches = map { s/^.* //; $_ } $dispatcher->complete($line);
+        return @matches;
+    };
+
+This API is experimental and subject to change. In particular I think I want to
+return an object that resembles L<Path::Dispatcher::Dispatch>.
+
 =head1 AUTHOR
 
 Shawn M Moore, C<< <sartak at bestpractical.com> >>

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list