Merge #139: Add --version

d924f39 Add --version option and show version in help text (Andrew Chow)
b99385c Add version number to __init__.py and docs to update that (Andrew Chow)

Pull request description:

  Adds version info and a `--version` option.

Tree-SHA512: 56562da645b555dabb40ba0508b35fc6a2bde0f510668f51f1be402a743796ca1be27afce4980589718768260c7469b373a6b8c8cc3a29e637ed7af071bd5bd4
This commit is contained in:
Andrew Chow 2019-03-09 14:28:09 -05:00
commit 2bf3d418e1
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41
3 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# Release Process
1. Bump version number in `pyproject.toml`, generate the setup.py file, and git tag release
1. Bump version number in `pyproject.toml` and `hwilib/__init__.py`, generate the setup.py file, and git tag release
2. Build distribution archives for PyPi with `contrib/build_dist.sh`
3. For MacOS and Linux, use `contrib/build_bin.sh`. This needs to be run on a MacOS machine for the MacOS binary and on a Linux machine for the linux one.
4. For Windows, use `contrib/build_wine.sh` to build the Windows binary using wine

View File

@ -0,0 +1 @@
__version__ = '0.0.5'

View File

@ -11,6 +11,7 @@ from .errors import (
UNKNWON_DEVICE_TYPE,
UNKNOWN_ERROR
)
from . import __version__
import argparse
import getpass
@ -58,7 +59,7 @@ def send_pin_handler(args, client):
return send_pin(client, pin=args.pin)
def process_commands(args):
parser = argparse.ArgumentParser(description='Access and send commands to a hardware wallet device. Responses are in JSON format')
parser = argparse.ArgumentParser(description='Hardware Wallet Interface, version {}.\nAccess and send commands to a hardware wallet device. Responses are in JSON format.'.format(__version__), formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--device-path', '-d', help='Specify the device path of the device to connect to')
parser.add_argument('--device-type', '-t', help='Specify the type of device that will be connected. If `--device-path` not given, the first device of this type enumerated is used.')
parser.add_argument('--password', '-p', help='Device password if it has one (e.g. DigitalBitbox)', default='')
@ -66,6 +67,7 @@ def process_commands(args):
parser.add_argument('--testnet', help='Use testnet prefixes', action='store_true')
parser.add_argument('--debug', help='Print debug statements', action='store_true')
parser.add_argument('--fingerprint', '-f', help='Specify the device to connect to using the first 4 bytes of the hash160 of the master public key. It will connect to the first device that matches this fingerprint.')
parser.add_argument('--version', action='version', version='%(prog)s {}'.format(__version__))
subparsers = parser.add_subparsers(description='Commands', dest='command')
# work-around to make subparser required