@@ -155,9 +155,11 @@ static struct io_plan *stderr_conn_init(struct io_conn *conn,
155
155
}
156
156
157
157
static struct command_result * reckless_call (struct command * cmd ,
158
- const char * call )
158
+ const char * subcommand ,
159
+ const char * target ,
160
+ const char * target2 )
159
161
{
160
- if (!call )
162
+ if (!subcommand || ! target )
161
163
return command_fail (cmd , PLUGIN_ERROR , "invalid reckless call" );
162
164
char * * my_call ;
163
165
my_call = tal_arrz (tmpctx , char * , 0 );
@@ -172,8 +174,10 @@ static struct command_result *reckless_call(struct command *cmd,
172
174
tal_arr_expand (& my_call , "--conf" );
173
175
tal_arr_expand (& my_call , lconfig .config );
174
176
}
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 );
177
181
tal_arr_expand (& my_call , NULL );
178
182
struct reckless * reckless ;
179
183
reckless = tal (NULL , struct reckless );
@@ -201,17 +205,21 @@ static struct command_result *reckless_call(struct command *cmd,
201
205
return command_still_pending (cmd );
202
206
}
203
207
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 )
207
211
{
208
- const char * search_target ;
212
+ const char * command ;
213
+ const char * target ;
214
+ const char * target2 ;
209
215
/* Allow check command to evaluate. */
210
216
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 ),
212
220
NULL ))
213
221
return command_param_failed ();
214
- return reckless_call (cmd , search_target );
222
+ return reckless_call (cmd , command , target , target2 );
215
223
}
216
224
217
225
static const char * init (struct plugin * p ,
@@ -242,8 +250,8 @@ static const char *init(struct plugin *p,
242
250
243
251
static const struct plugin_command commands [] = {
244
252
{
245
- "reckless-search " ,
246
- json_search ,
253
+ "reckless" ,
254
+ json_reckless ,
247
255
},
248
256
};
249
257
0 commit comments