diff options
author | franck cuny <franck@lumberjaph.net> | 2010-06-08 17:30:55 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-06-08 17:33:00 +0200 |
commit | 2bb154b2b3bbe819c98a01d9d43f2183e6389401 (patch) | |
tree | 1a304667863e5feb12c543dfbb72a579e88901c9 /lib/Net/HTTP/Console/Dispatcher/Help.pm | |
parent | move code to appropriate role (diff) | |
download | net-http-console-2bb154b2b3bbe819c98a01d9d43f2183e6389401.tar.gz |
add dispatcher for viewing content; update help
Diffstat (limited to 'lib/Net/HTTP/Console/Dispatcher/Help.pm')
-rw-r--r-- | lib/Net/HTTP/Console/Dispatcher/Help.pm | 75 |
1 files changed, 56 insertions, 19 deletions
diff --git a/lib/Net/HTTP/Console/Dispatcher/Help.pm b/lib/Net/HTTP/Console/Dispatcher/Help.pm index a7a774b..6218676 100644 --- a/lib/Net/HTTP/Console/Dispatcher/Help.pm +++ b/lib/Net/HTTP/Console/Dispatcher/Help.pm @@ -13,6 +13,14 @@ class Net::HTTP::Console::Dispatcher::Help with Net::HTTP::Console::Dispatcher { } elsif ($cmd eq 'command') { $self->_list_commands(); + }elsif($cmd eq 'view') { + $self->_help_about_view(); + }elsif($cmd eq 'set') { + $self->_help_about_set(); + }elsif($cmd eq 'request') { + $self->_help_about_request(); + }elsif($cmd eq 'load') { + $self->_help_about_load(); } } else { @@ -29,33 +37,62 @@ class Net::HTTP::Console::Dispatcher::Help with Net::HTTP::Console::Dispatcher { print <<EOF help command - help about a command help request - help on how to write request +help set - help on how to set values +help view - help on how to view values +help load - help on how to load a lib EOF } - method _list_commands { - my @methods = - $self->application->api_object->meta->get_all_net_api_methods(); + method _list_commands { + my @methods = + $self->application->api_object->meta->get_all_net_api_methods(); - if (!@methods) { - print "no method available\n"; - return; - } + if (!@methods) { + print "no method available\n"; + return; + } + + print "available commands:\n"; + map { print "- " . $_ . "\n" } @methods; + } + + method _get_help_for_command($cmd_name) { + my $method = + $self->application->api_object->meta->find_net_api_method_by_name($cmd_name); + + if (!$method) { + print "unknown method " . $cmd_name . "\n"; + return; + } + + print $method->documentation; + } - print "available commands:\n"; - map { print "- " . $_ . "\n" } @methods; - } + method _help_about_view { + print <<EOF +view headers - show the headers of the last request +view content - show the last content +view defined_headers - show the defined headers +EOF + } - method _get_help_for_command($cmd_name) { - my $method = - $self->application->api_object->meta->find_net_api_method_by_name($cmd_name); + method _help_about_set { + print <<EOF +set header key value - set the value for a header (global) +EOF + } - if (!$method) { - print "unknown method " . $cmd_name . "\n"; - return; - } + method _help_about_request { + print <<EOF +HTTP Method path - make a HTTP request on a path +EOF + } - print $method->documentation; - } + method _help_about_load { + print <<EOF +load libname - load a MooseX::Net::API library +EOF + } } 1; |