From bb8a1e33d65add7e473811d26242ce337dbad82b Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 31 Jul 2018 11:35:24 -0400 Subject: [PATCH] improve cli, add changelog file --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ README.md | 15 +++++++++------ txupnp/cli.py | 10 +++++----- 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c3070fb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,33 @@ +# Change Log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/) with +regard to the json-rpc api. As we're currently pre-1.0 release, we +can and probably will change functionality and break backwards compatability +at anytime. + +## [Unreleased] +### Security + * + * + +### Fixed + * + * + +### Deprecated + * + * + +### Changed + * + * + +### Added + * + * + +### Removed + * + * diff --git a/README.md b/README.md index de8e88f..34c65bc 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,16 @@ pip install -e . ## Usage -`txupnp-cli --help` +``` +usage: txupnp-cli [-h] [--debug_logging] command -`txupnp-cli --command=debug` to get gateway debugging information +positional arguments: + command debug_gateway | list_mappings -`txupnp-cli --command=list_mappings` to show redirects - -`txupnp-cli --debug` to turn on very verbose logging +optional arguments: + -h, --help show this help message and exit + --debug_logging +``` ## License @@ -27,4 +30,4 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE). ## Contact -The primary contact for this project is @jackrobison(jackrobison@lbry.io) +The primary contact for this project is @jackrobison diff --git a/txupnp/cli.py b/txupnp/cli.py index a95e939..38746f3 100644 --- a/txupnp/cli.py +++ b/txupnp/cli.py @@ -13,7 +13,7 @@ def run_command(found, u, command): print("failed to find gateway") reactor.callLater(0, reactor.stop) return - if command == "debug": + if command == "debug_device": external_ip = yield u.get_external_ip() print(u.get_debug_info()) print("external ip: ", external_ip) @@ -26,16 +26,16 @@ def run_command(found, u, command): def main(): parser = argparse.ArgumentParser(description="upnp command line utility") - parser.add_argument("--command", dest="command", type=str, help="debug | list_mappings", default="debug") - parser.add_argument("--debug", dest="debug", default=False, action="store_true") + parser.add_argument(dest="command", type=str, help="debug_gateway | list_mappings") + parser.add_argument("--debug_logging", dest="debug_logging", default=False, action="store_true") args = parser.parse_args() - if args.debug: + if args.debug_logging: from twisted.python import log as tx_log observer = tx_log.PythonLoggingObserver(loggerName="txupnp") observer.start() log.setLevel(logging.DEBUG) command = args.command - if command not in ['debug', 'list_mappings']: + if command not in ['debug_device', 'list_mappings']: return sys.exit(0) u = UPnP(reactor)