From: erickson Date: Wed, 16 Mar 2005 03:07:17 +0000 (+0000) Subject: added an 'introspect' command X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f2263bbe742600a21d305a9e00468f76a04d333a;p=opensrf%2Fbjwebb.git added an 'introspect' command git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@238 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index d62b281..85f63bf 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -167,6 +167,9 @@ int parse_request( char* request ) { else if (!strcmp(words[0],"math_bench")) ret_val = handle_math(words); + else if (!strcmp(words[0],"introspect")) + ret_val = handle_introspect(words); + else if (words[0][0] == '!') ret_val = handle_exec( words ); @@ -177,6 +180,22 @@ int parse_request( char* request ) { } + +int handle_introspect(char* words[]) { + + if(words[1]) { + fprintf(stderr, "--> %s\n", words[1]); + char buf[256]; + memset(buf,0,256); + sprintf( buf, "request %s opensrf.system.method.all", words[1] ); + return parse_request( buf ); + } + + return 0; +} + + + int handle_set( char* words[]) { char* variable; @@ -501,19 +520,27 @@ int print_help() { "set - set a srfsh variable (e.g. set pretty_print true )\n" "print - Displays the value of a srfsh variable\n" "---------------------------------------------------------------------------------\n" + "router query servers \n" " - Returns stats on connected services\n" "\n" + "\n" "request [ ]\n" " - Anything passed in will be wrapped in a json array,\n" " so add commas if there is more than one param\n" "\n" + "\n" "relay \n" " - Performs the requested query using the last received result as the param\n" "\n" + "\n" "math_bench [0|1|2]\n" " - 0 means don't reconnect, 1 means reconnect after each batch of 4, and\n" " 2 means reconnect after every request\n" + "\n" + "introspect \n" + " - prints the API for the service\n" + "\n" "---------------------------------------------------------------------------------\n" "Note: long output is piped through 'less'. To search in 'less', type: /\n" "---------------------------------------------------------------------------------\n" diff --git a/src/srfsh/srfsh.h b/src/srfsh/srfsh.h index 37af2f8..ab5902d 100644 --- a/src/srfsh/srfsh.h +++ b/src/srfsh/srfsh.h @@ -60,6 +60,5 @@ void sig_int_handler( int s ); int load_history(); int handle_math( char* words[] ); int do_math( int count, int style ); - - +int handle_introspect(char* words[]);