Browse Source

Add --version option to cli scripts

master
Kristaps Kaupe 6 years ago
parent
commit
e5cf95d0d2
  1. 12
      jmbase/jmbase/support.py
  2. 5
      jmclient/jmclient/cli_options.py
  3. 3
      scripts/joinmarket-qt.py

12
jmbase/jmbase/support.py

@ -1,8 +1,10 @@
import logging
import logging, sys
from getpass import getpass
from os import path, environ
import sys
# JoinMarket version
JM_CORE_VERSION = '0.6.2'
# global Joinmarket constants
JM_WALLET_NAME_PREFIX = "joinmarket-wallet-"
@ -143,4 +145,8 @@ def lookup_appdata_folder(appname):
data_folder = path.join(environ['APPDATA'], appname) + '\\'
else:
data_folder = path.expanduser(path.join("~", "." + appname + "/"))
return data_folder
return data_folder
def print_jm_version(option, opt_str, value, parser):
print("JoinMarket " + JM_CORE_VERSION)
sys.exit(EXIT_SUCCESS)

5
jmclient/jmclient/cli_options.py

@ -6,6 +6,7 @@ from configparser import NoOptionError
import jmclient.support
from jmbase import JM_APP_NAME
from jmclient import jm_single, RegtestBitcoinCoreInterface, cryptoengine
from jmbase.support import print_jm_version
"""This exists as a separate module for two reasons:
to reduce clutter in main scripts, and refactor out
@ -46,6 +47,10 @@ def add_base_options(parser):
default=False,
dest='wallet_password_stdin',
help='Read wallet password from stdin')
parser.add_option('--version',
action='callback',
callback=print_jm_version,
help='Print JoinMarket version and exit.')
def add_common_options(parser):
add_base_options(parser)

3
scripts/joinmarket-qt.py

@ -41,6 +41,7 @@ else:
MONOSPACE_FONT = 'monospace'
import jmbitcoin as btc
from jmbase.support import JM_CORE_VERSION
# This is required to change the decimal separator
# to '.' regardless of the locale; TODO don't require
@ -60,8 +61,6 @@ donation_address = "1AZgQZWYRteh6UyF87hwuvyWj73NvWKpL"
donation_address_sw = "bc1q5x02zqj5nshw0yhx2s4tj75z6vkvuvww26jak5"
donation_address_url = "https://bitcoinprivacy.me/joinmarket-donations"
#Underlying joinmarket code version (as per setup.py etc.)
JM_CORE_VERSION = '0.6.2'
#Version of this Qt script specifically
JM_GUI_VERSION = '12'

Loading…
Cancel
Save