summary refs log tree commit diff
path: root/lib/Net/HTTP/Console/Dispatcher/Help.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-08 17:30:55 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-08 17:33:00 +0200
commit2bb154b2b3bbe819c98a01d9d43f2183e6389401 (patch)
tree1a304667863e5feb12c543dfbb72a579e88901c9 /lib/Net/HTTP/Console/Dispatcher/Help.pm
parentmove code to appropriate role (diff)
downloadnet-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.pm75
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;