Compare commits
No commits in common. "d489362a28395f47baff248fdd4170acb79c4cdb" and "d820bc2f23eb736575554e20621b4df80e7b1dc6" have entirely different histories.
d489362a28
...
d820bc2f23
@ -663,14 +663,6 @@ input_el_install_prompt (struct input_el *self)
|
||||
|
||||
static unsigned char input_el_on_complete (EditLine *editline, int key);
|
||||
|
||||
static void
|
||||
input_el_addbind (EditLine *editline, const char *name, const char *desc,
|
||||
unsigned char (*function) (EditLine *, int), const char *binding)
|
||||
{
|
||||
el_set (editline, EL_ADDFN, name, desc, function);
|
||||
el_set (editline, EL_BIND, binding, name, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
input_el_start (struct input *input, const char *program_name)
|
||||
{
|
||||
@ -689,15 +681,16 @@ input_el_start (struct input *input, const char *program_name)
|
||||
el_set (self->editline, EL_BIND, "^u", "vi-kill-line-prev", NULL);
|
||||
|
||||
// It's probably better to handle these ourselves
|
||||
input_el_addbind (self->editline, "send-line", "Send line",
|
||||
input_el_on_return, "\n");
|
||||
input_el_addbind (self->editline, "run-editor", "Run editor to edit line",
|
||||
input_el_on_run_editor, "M-e");
|
||||
el_set (self->editline, EL_ADDFN,
|
||||
"send-line", "Send line", input_el_on_return);
|
||||
el_set (self->editline, EL_BIND, "\n", "send-line", NULL);
|
||||
el_set (self->editline, EL_ADDFN,
|
||||
"run-editor", "Run editor to edit line", input_el_on_run_editor);
|
||||
el_set (self->editline, EL_BIND, "M-e", "run-editor", NULL);
|
||||
|
||||
input_el_addbind (self->editline, "complete", "Complete word",
|
||||
input_el_on_complete, "\t");
|
||||
input_el_addbind (self->editline, "newline-insert", "Insert a newline",
|
||||
input_el_on_newline_insert, "M-\n");
|
||||
el_set (self->editline, EL_ADDFN,
|
||||
"newline-insert", "Insert a newline", input_el_on_newline_insert);
|
||||
el_set (self->editline, EL_BIND, "M-\n", "newline-insert", NULL);
|
||||
|
||||
// Source the user's defaults file
|
||||
el_source (self->editline, NULL);
|
||||
|
@ -1446,38 +1446,6 @@ json_rpc_handler_info_cmp (const void *first, const void *second)
|
||||
((struct json_rpc_handler_info *) second)->method_name);
|
||||
}
|
||||
|
||||
static json_t *
|
||||
open_rpc_describe (const char *method, json_t *result)
|
||||
{
|
||||
return json_pack ("{sssoso}", "name", method, "params", json_pack ("[]"),
|
||||
"result", json_pack ("{ssso}", "name", method, "schema", result));
|
||||
}
|
||||
|
||||
// This server rarely sees changes and we can afford to hardcode the schema
|
||||
static json_t *
|
||||
json_rpc_discover (struct server_context *ctx, json_t *params)
|
||||
{
|
||||
(void) ctx;
|
||||
(void) params;
|
||||
|
||||
json_t *info = json_pack ("{ssss}",
|
||||
"title", PROGRAM_NAME, "version", PROGRAM_VERSION);
|
||||
json_t *methods = json_pack ("[ooo]",
|
||||
open_rpc_describe ("date", json_pack ("{ssso}", "type", "object",
|
||||
"properties", json_pack ("{s{ss}s{ss}s{ss}s{ss}s{ss}s{ss}}",
|
||||
"year", "type", "number",
|
||||
"month", "type", "number",
|
||||
"day", "type", "number",
|
||||
"hours", "type", "number",
|
||||
"minutes", "type", "number",
|
||||
"seconds", "type", "number"))),
|
||||
open_rpc_describe ("ping", json_pack ("{ss}", "type", "string")),
|
||||
open_rpc_describe ("rpc.discover", json_pack ("{ss}", "$ref",
|
||||
"https://github.com/open-rpc/meta-schema/raw/master/schema.json")));
|
||||
return json_rpc_response (NULL, json_pack ("{sssoso}",
|
||||
"openrpc", "1.2.6", "info", info, "methods", methods), NULL);
|
||||
}
|
||||
|
||||
static json_t *
|
||||
json_rpc_ping (struct server_context *ctx, json_t *params)
|
||||
{
|
||||
@ -1521,7 +1489,6 @@ process_json_rpc_request (struct server_context *ctx, json_t *request)
|
||||
{
|
||||
{ "date", json_rpc_date },
|
||||
{ "ping", json_rpc_ping },
|
||||
{ "rpc.discover", json_rpc_discover },
|
||||
};
|
||||
|
||||
if (!json_is_object (request))
|
||||
|
Loading…
x
Reference in New Issue
Block a user