Skip to content

Commit 3c0fec0

Browse files
reckless: report version without loading config
1 parent 8a0e473 commit 3c0fec0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/test_reckless.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ def test_basic_help():
170170
assert r.search_stdout("options:") or r.search_stdout("optional arguments:")
171171

172172

173+
def test_version():
174+
'''Version should be reported without loading config and should advance
175+
with lightningd'''
176+
r = reckless(["-V", "-v", "--json"])
177+
assert r.returncode == 0
178+
import json
179+
json_out = ''.join(r.stdout)
180+
with open('.version', 'r') as f:
181+
version = f.readlines()[0].strip()
182+
assert json.loads(json_out)['result'][0] == version
183+
184+
173185
def test_contextual_help(node_factory):
174186
n = get_reckless_node(node_factory)
175187
for subcmd in ['install', 'uninstall', 'search',

tools/reckless

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,9 @@ if __name__ == '__main__':
20362036
'litecoin', 'signet', 'testnet', 'testnet4']
20372037
if args.version:
20382038
report_version()
2039+
if log.capture:
2040+
log.reply_json()
2041+
sys.exit(0)
20392042
elif args.cmd1 is None:
20402043
parser.print_help(sys.stdout)
20412044
sys.exit(1)

0 commit comments

Comments
 (0)