improve cli, add changelog file

This commit is contained in:
Jack Robison 2018-07-31 11:35:24 -04:00
parent f9c6ce9bd6
commit bb8a1e33d6
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 47 additions and 11 deletions

33
CHANGELOG.md Normal file
View file

@ -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
*
*

View file

@ -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

View file

@ -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)