|
@ -104,7 +104,7 @@ static void human_help(const char *buffer, const jsmntok_t *result) { |
|
|
curr++; |
|
|
curr++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
printf("---\nrun `man lightning-{command}` for more information on each command\n"); |
|
|
printf("---\nrun `lightning-cli help <command>` for more information on a specific command\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
enum format { |
|
|
enum format { |
|
@ -168,6 +168,12 @@ static void add_input(char **cmd, const char *input, |
|
|
tal_append_fmt(cmd, ", "); |
|
|
tal_append_fmt(cmd, ", "); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
exec_man (const char *page) { |
|
|
|
|
|
execlp("man", "man", page, (char *)NULL); |
|
|
|
|
|
err(1, "Running man command"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) |
|
|
int main(int argc, char *argv[]) |
|
|
{ |
|
|
{ |
|
|
setup_locale(); |
|
|
setup_locale(); |
|
@ -223,6 +229,14 @@ int main(int argc, char *argv[]) |
|
|
format = JSON; |
|
|
format = JSON; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Launch a manpage if we have a help command with an argument. We do
|
|
|
|
|
|
* not need to have lightningd running in this case. */ |
|
|
|
|
|
if (streq(method, "help") && format == HUMAN && argc >= 3) { |
|
|
|
|
|
char command[strlen(argv[2]) + sizeof("lightning-")]; |
|
|
|
|
|
sprintf(command, "lightning-%s", argv[2]); |
|
|
|
|
|
exec_man(command); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (chdir(lightning_dir) != 0) |
|
|
if (chdir(lightning_dir) != 0) |
|
|
err(ERROR_TALKING_TO_LIGHTNINGD, "Moving into '%s'", |
|
|
err(ERROR_TALKING_TO_LIGHTNINGD, "Moving into '%s'", |
|
|
lightning_dir); |
|
|
lightning_dir); |
|
|