@@ -163,9 +163,11 @@ static struct io_plan *stderr_conn_init(struct io_conn *conn,
163
163
}
164
164
165
165
static struct command_result * reckless_call (struct command * cmd ,
166
- const char * call )
166
+ const char * subcommand ,
167
+ const char * target ,
168
+ const char * target2 )
167
169
{
168
- if (!call )
170
+ if (!subcommand || ! target )
169
171
return command_fail (cmd , PLUGIN_ERROR , "invalid reckless call" );
170
172
char * * my_call ;
171
173
my_call = tal_arrz (tmpctx , char * , 0 );
@@ -180,8 +182,10 @@ static struct command_result *reckless_call(struct command *cmd,
180
182
tal_arr_expand (& my_call , "--conf" );
181
183
tal_arr_expand (& my_call , lconfig .config );
182
184
}
183
- tal_arr_expand (& my_call , "search" );
184
- tal_arr_expand (& my_call , (char * ) call );
185
+ tal_arr_expand (& my_call , (char * ) subcommand );
186
+ tal_arr_expand (& my_call , (char * ) target );
187
+ if (target2 )
188
+ tal_arr_expand (& my_call , (char * ) target2 );
185
189
tal_arr_expand (& my_call , NULL );
186
190
struct reckless * reckless ;
187
191
reckless = tal (NULL , struct reckless );
@@ -212,17 +216,21 @@ static struct command_result *reckless_call(struct command *cmd,
212
216
return command_still_pending (cmd );
213
217
}
214
218
215
- static struct command_result * json_search (struct command * cmd ,
216
- const char * buf ,
217
- const jsmntok_t * params )
219
+ static struct command_result * json_reckless (struct command * cmd ,
220
+ const char * buf ,
221
+ const jsmntok_t * params )
218
222
{
219
- const char * search_target ;
223
+ const char * subcommand ;
224
+ const char * target ;
225
+ const char * target2 ;
220
226
/* Allow check command to evaluate. */
221
227
if (!param (cmd , buf , params ,
222
- p_req ("plugin" , param_string , & search_target ),
228
+ p_req ("subcommand" , param_string , & subcommand ),
229
+ p_req ("target/subcommand2" , param_string , & target ),
230
+ p_opt ("target" , param_string , & target2 ),
223
231
NULL ))
224
232
return command_param_failed ();
225
- return reckless_call (cmd , search_target );
233
+ return reckless_call (cmd , subcommand , target , target2 );
226
234
}
227
235
228
236
static const char * init (struct plugin * p ,
@@ -253,11 +261,11 @@ static const char *init(struct plugin *p,
253
261
254
262
static const struct plugin_command commands [] = {
255
263
{
256
- "reckless-search" , /* Name */
257
- "reckless" , /* Category */
258
- "ask reckless to search for a plugin" , /* Descr */
259
- "long description here" , /* Long descr */
260
- json_search , /* Command pointer */
264
+ "reckless" ,
265
+ "utility" ,
266
+ "Issue a command to the reckless utility." ,
267
+ "" ,
268
+ json_reckless ,
261
269
},
262
270
};
263
271
0 commit comments