@@ -155,9 +155,11 @@ static struct io_plan *stderr_conn_init(struct io_conn *conn,
155155}
156156
157157static struct command_result * reckless_call (struct command * cmd ,
158- const char * call )
158+ const char * subcommand ,
159+ const char * target ,
160+ const char * target2 )
159161{
160- if (!call )
162+ if (!subcommand || ! target )
161163 return command_fail (cmd , PLUGIN_ERROR , "invalid reckless call" );
162164 char * * my_call ;
163165 my_call = tal_arrz (tmpctx , char * , 0 );
@@ -172,8 +174,10 @@ static struct command_result *reckless_call(struct command *cmd,
172174 tal_arr_expand (& my_call , "--conf" );
173175 tal_arr_expand (& my_call , lconfig .config );
174176 }
175- tal_arr_expand (& my_call , "search" );
176- tal_arr_expand (& my_call , (char * ) call );
177+ tal_arr_expand (& my_call , (char * ) subcommand );
178+ tal_arr_expand (& my_call , (char * ) target );
179+ if (target2 )
180+ tal_arr_expand (& my_call , (char * ) target2 );
177181 tal_arr_expand (& my_call , NULL );
178182 struct reckless * reckless ;
179183 reckless = tal (NULL , struct reckless );
@@ -201,17 +205,21 @@ static struct command_result *reckless_call(struct command *cmd,
201205 return command_still_pending (cmd );
202206}
203207
204- static struct command_result * json_search (struct command * cmd ,
205- const char * buf ,
206- const jsmntok_t * params )
208+ static struct command_result * json_reckless (struct command * cmd ,
209+ const char * buf ,
210+ const jsmntok_t * params )
207211{
208- const char * search_target ;
212+ const char * command ;
213+ const char * target ;
214+ const char * target2 ;
209215 /* Allow check command to evaluate. */
210216 if (!param (cmd , buf , params ,
211- p_req ("plugin" , param_string , & search_target ),
217+ p_req ("command" , param_string , & command ),
218+ p_req ("target/subcommand" , param_string , & target ),
219+ p_opt ("target" , param_string , & target2 ),
212220 NULL ))
213221 return command_param_failed ();
214- return reckless_call (cmd , search_target );
222+ return reckless_call (cmd , command , target , target2 );
215223}
216224
217225static const char * init (struct plugin * p ,
@@ -242,8 +250,8 @@ static const char *init(struct plugin *p,
242250
243251static const struct plugin_command commands [] = {
244252 {
245- "reckless-search " ,
246- json_search ,
253+ "reckless" ,
254+ json_reckless ,
247255 },
248256};
249257
0 commit comments