Commit 8eef32ba authored by Moul's avatar Moul
Browse files

[enh] #87: Add option to specify official Ğ1-test node.

parent df132398
...@@ -3,3 +3,4 @@ NO_MATCHING_ID = "No matching identity" ...@@ -3,3 +3,4 @@ NO_MATCHING_ID = "No matching identity"
G1_SYMBOL = "Ğ1" G1_SYMBOL = "Ğ1"
GTEST_SYMBOL = "ĞTest" GTEST_SYMBOL = "ĞTest"
G1_DEFAULT_ENDPOINT = "g1.duniter.org", "443" G1_DEFAULT_ENDPOINT = "g1.duniter.org", "443"
G1_TEST_DEFAULT_ENDPOINT = "g1-test.duniter.org", "443"
...@@ -12,15 +12,18 @@ from tools import message_exit ...@@ -12,15 +12,18 @@ from tools import message_exit
from network_tools import check_port, best_node from network_tools import check_port, best_node
from wot import received_sent_certifications, id_pubkey_correspondence from wot import received_sent_certifications, id_pubkey_correspondence
from auth import generate_auth_file from auth import generate_auth_file
from constants import SILKAJ_VERSION, G1_DEFAULT_ENDPOINT from constants import SILKAJ_VERSION, G1_SYMBOL, GTEST_SYMBOL, G1_DEFAULT_ENDPOINT, G1_TEST_DEFAULT_ENDPOINT
def usage(): def usage():
message_exit("Silkaj: command line Duniter client \ message_exit("Silkaj: command line client for Duniter currencies\
\n\nhelp: -h, --help, --usage \ \n\nhelp: -h, --help, --usage \
\nversion: -v, --version \ \nversion: -v, --version \
\n \ \n \
\nCustom endpoint with option `-p` and <domain>:<port>\ \nEndpoint:\
\nDefault endpoint will reach " + G1_SYMBOL + " currency with `https://" + G1_DEFAULT_ENDPOINT[0] + "` endpoint\
\n - `--gtest` to reach " + GTEST_SYMBOL + " currency with `https://" + G1_TEST_DEFAULT_ENDPOINT[0] + "` endpoint\
\n - custom endpoint can be specified with `-p` option followed by <domain>:<port>\
\n \ \n \
\nCommands: \ \nCommands: \
\n - info: Display information about currency \ \n - info: Display information about currency \
...@@ -81,7 +84,7 @@ def cli(): ...@@ -81,7 +84,7 @@ def cli():
message_exit(SILKAJ_VERSION) message_exit(SILKAJ_VERSION)
if cli_args.is_help_request() or cli_args.is_usage_request() or cli_args.subcmd not in subcmd: if cli_args.is_help_request() or cli_args.is_usage_request() or cli_args.subcmd not in subcmd:
usage() usage()
ep["domain"], ep["port"] = G1_DEFAULT_ENDPOINT ep["domain"], ep["port"] = G1_TEST_DEFAULT_ENDPOINT if cli_args.contains_switches("gtest") else G1_DEFAULT_ENDPOINT
try: try:
ep["domain"], ep["port"] = cli_args.get_definition('p').rsplit(':', 1) ep["domain"], ep["port"] = cli_args.get_definition('p').rsplit(':', 1)
except: except:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment