Commit Graph

34 Commits

Author SHA1 Message Date
William Casarin 41468fb607 cli: source help from local docs when not installed
Teach `lightning-cli help` to look in the doc directory relative to
lightning-cli if it can't find the manpage in any man paths.

This makes `lightning-cli help` work even if clightning hasn't been installed
yet.

Signed-off-by: William Casarin <jb55@jb55.com>
2019-01-11 04:57:58 +00:00
lisa neigut b2ee53fd89 lightning-cli: add jsonrpc version to cmd json packet
Plugins expect jsonrpc commands to include the version, so let's include
it.
2018-12-22 16:30:06 +01:00
Rusty Russell 12731c4a60 json_tok_len, json_tok_contents: rename to json_tok_full_len and json_tok_full
These are only supposed to be used when you want the token contents including
surrounding "".  We should use this when reporting errors, but usually
we just want to access the tok members directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-12-20 03:22:32 +00:00
Rusty Russell 8238fe6acf common/json: only maintain array of nested types if DEVELOPER mode.
My test case is a mainnet gossip store with 22107 channels, and
time to do `lightning-cli listchannels`:

Before: `lightning-cli listchannels` DEVELOPER=0
	real	0m1.396000-1.409000(1.4022+/-0.005)s

After:
	real	0m1.307000-1.320000(1.3128+/-0.005)s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-19 22:02:11 +00:00
Rusty Russell 305795b01e common/json: move JSON creation routines into lightningd/
It's the only user of them, and it's going to get optimized.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

gossip.pydiff --git a/common/test/run-json.c b/common/test/run-json.c
index 956fdda35..db52d6b01 100644
2018-10-19 22:02:11 +00:00
William Casarin 8f405ca9a7 cli: fix human help output for the new jsonrpc help response
Now that we're returning all the help data, we need to update the human_help
formatter to handle the extra data.

Signed-off-by: William Casarin <jb55@jb55.com>
2018-10-10 06:09:29 +00:00
William Casarin d23a0e8adc cli: handle missing manpages gracefully
Instead of exiting when we can't find a manpage, set the command and continue so
that we can try the json rpc for help.

Signed-off-by: William Casarin <jb55@jb55.com>
2018-10-10 06:09:29 +00:00
Corné Plooy f1df9dfa4d lightning-cli: consider empty inputs to be strings 2018-08-07 13:47:07 +02:00
practicalswift 9d9a9523d0 Use snprintf(...) instead of sprintf(...) 2018-08-02 16:14:21 +09:30
Rusty Russell 337075dc8c tal: don't access low-level tal functions.
In several places we use low-level tal functions because we want the
label to be something other than the default.  ccan/tal is adding
tal_*_label so replace them and shim it for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-30 11:31:17 +02:00
Rusty Russell 5cf34d6618 Remove tal_len, use tal_count() or tal_bytelen().
tal_count() is used where there's a type, even if it's char or u8, and
tal_bytelen() is going to replace tal_len() for clarity: it's only needed
where a pointer is void.

We shim tal_bytelen() for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-07-30 11:31:17 +02:00
William Casarin a9cf73380a cli: launch a manpage when help is passed an argument
example

  lightning-cli help pay
  lightning-cli help cli

Signed-off-by: William Casarin <jb55@jb55.com>
2018-07-07 05:01:31 +00:00
William Casarin a88ab1634f cli: add manpage hint at the end of human help output
It may not immediately obvious that this is available

Signed-off-by: William Casarin <jb55@jb55.com>
2018-07-02 00:09:59 +02:00
Rusty Russell 666e1b320f lightningd: fix double-specified args.
We need to make sure the arg is a tal object, as we'll free it next time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-05 17:55:10 +02:00
practicalswift abf510740d Force the use of the POSIX C locale for all commands and their subprocesses 2018-04-27 14:02:59 +02:00
practicalswift 6269a4c55d Remove unused functions not covered by unit tests 2018-03-26 23:35:56 +00:00
Rusty Russell 7ae013202f json: make json_add_string do partial escapes.
This is useful when we log a JSON-escaped string, so we don't double-escape.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-26 00:20:53 +00:00
practicalswift 98f49c0837 Remove include in file foo.c that is already included in foo.h 2018-03-25 23:54:21 +00:00
Mark Beckwith 38e94e883f Improved display of lightning-cli help for humans
The display format is now:

command1
    description1

command2
    description2

    .
    .
    .
2018-03-03 19:40:22 +01:00
ZmnSCPxj cabeef2d88 lightning-cli: Be more discerning about literals.
Fixes: #574

The issue states that we should follow the standard when
parsing the port for IPv6 [addr]:port syntax, but this is
actually already supported by the daemon. The issue arises
due to the `lightning-cli` misinterpreting [addr]:port as
an array. This modification makes [addr]:port interpreted
as a string.
2018-02-25 20:44:32 +00:00
practicalswift 91a9c2923f Mark intentionally unused parameters as such (with "UNUSED") 2018-02-22 01:09:12 +00:00
Rusty Russell 8be1c1df32 Updates for changed external/jsmn API change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-05 04:08:16 +00:00
Rusty Russell c3bd78433f lightning-cli: keyword mode.
By default, autodetect, but that's unreliable, so use -k/-o to force
interpretation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 7d18ef9ecf lightning-cli: human-readable printing for help.
And make it an option for now for other commands; consider making
it the default.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
practicalswift 2c17546cbd Onboarding: Make "lightning-cli" (without arguments) output the equivalent of "lightning-cli --help; lightning-cli help"
New users invoking lightning-cli are likely interested in what RPC
commands they can invoke via the command.
2018-01-26 00:35:13 +00:00
ZmnSCPxj 940819567d lightning-cli: Add support for null argument. 2018-01-23 12:21:56 +01:00
Rusty Russell 1bd40a8da6 lightning-cli: make valgrind happy by freeing opt table.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-22 18:58:23 +01:00
Rusty Russell aa34ad30d9 lighting-cli: do incremental parsing.
Far less hacky, and a little faster:

real	0m0.168s
user	0m0.135s
sys	0m0.033s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-22 18:58:23 +01:00
Rusty Russell 61cff03465 lightning-cli: test for amazingly slow getlogs speed.
real	3m51.167s
user	3m51.065s
sys	0m0.080s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-22 18:58:23 +01:00
renepickhardt 69260adb38 quickfixing issue #662 to make CLI more userfriendly for inexperienced users (#663)
* making the cli more user friendly for inexperienced users #662

providing a quickfix for https://github.com/ElementsProject/lightning/issues/662

Basically I extended the ./lighting-cli --help message to at least state that one should use ./lighting-cli help, and added a hint to cli/lighting-cli help to the README

Closes: #662
2018-01-19 10:09:54 +00:00
Rusty Russell 739b163f8b Makefiles: simplify dependencies.
Gather all binaries and objects and make the depend on external
requirements and common headers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell f42f34b82d external: new subdirectory for all external libraries and submodules.
You will want to 'make distclean' after this.

I also removed libsecp; we use the one in in libwally anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell a37c165cb9 common: move some files out of lightningd/
Basically all files shared by different daemons.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell 8375857116 common: absorb remaining files from daemon/
Also, we split the more sophisticated json_add helpers to avoid pulling in
everything into lightning-cli, and unify the routines to print struct
short_channel_id (it's ':',  not '/' too).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00