{"action":"created","issue":{"url":"https://api.github.com/repos/python-escpos/python-escpos/issues/107","repository_url":"https://api.github.com/repos/python-escpos/python-escpos","labels_url":"https://api.github.com/repos/python-escpos/python-escpos/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/python-escpos/python-escpos/issues/107/comments","events_url":"https://api.github.com/repos/python-escpos/python-escpos/issues/107/events","html_url":"https://github.com/python-escpos/python-escpos/pull/107","id":140433317,"number":107,"title":"Improve cli.py","user":{"login":"DavisGoglin","id":205764,"avatar_url":"https://avatars.githubusercontent.com/u/205764?v=3","gravatar_id":"","url":"https://api.github.com/users/DavisGoglin","html_url":"https://github.com/DavisGoglin","followers_url":"https://api.github.com/users/DavisGoglin/followers","following_url":"https://api.github.com/users/DavisGoglin/following{/other_user}","gists_url":"https://api.github.com/users/DavisGoglin/gists{/gist_id}","starred_url":"https://api.github.com/users/DavisGoglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavisGoglin/subscriptions","organizations_url":"https://api.github.com/users/DavisGoglin/orgs","repos_url":"https://api.github.com/users/DavisGoglin/repos","events_url":"https://api.github.com/users/DavisGoglin/events{/privacy}","received_events_url":"https://api.github.com/users/DavisGoglin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-13T01:06:45Z","updated_at":"2016-03-15T00:42:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/python-escpos/python-escpos/pulls/107","html_url":"https://github.com/python-escpos/python-escpos/pull/107","diff_url":"https://github.com/python-escpos/python-escpos/pull/107.diff","patch_url":"https://github.com/python-escpos/python-escpos/pull/107.patch"},"body":"### Contributor checklist\r\n<!-- mark with x between the brackets -->\r\n- [x] I have read the CONTRIBUTING.rst\r\n- [x] I have tested my contribution on these devices:\r\n * Star TSP100\r\n- [x] My contribution is ready to be merged as is\r\n\r\n----------\r\n\r\n### Description\r\n\r\nRewrote `cli.py` to be a mapping of the features of escpos.py.\r\n\r\nUsage is `python -m escpos.cli destination_type [--args] escpos_command [--args]`. \r\n\r\nA side effect of using `argparse` is that you can't have more than one subparser, e.g. only destination or only escpos_command. I did a workaround which involves having two instances of `argparse`, each with a single subparser. One runs, then the other runs with whatever commands are left over. As a side effect, the `--help` command doesn't show all of the commands, and adding `--help` shows the help for only destination_type and not escpos_command. Having two subparsers is awkward, but it's nice to get so much functionality just by filling out two `argparse` instances. \r\n\r\nTodo:\r\n\r\n - Add more functionality, such as pre built tests\r\n - Fix argparse help awkwardness by combining both helps, or change architecture"},"comment":{"url":"https://api.github.com/repos/python-escpos/python-escpos/issues/comments/196587391","html_url":"https://github.com/python-escpos/python-escpos/pull/107#issuecomment-196587391","issue_url":"https://api.github.com/repos/python-escpos/python-escpos/issues/107","id":196587391,"user":{"login":"DavisGoglin","id":205764,"avatar_url":"https://avatars.githubusercontent.com/u/205764?v=3","gravatar_id":"","url":"https://api.github.com/users/DavisGoglin","html_url":"https://github.com/DavisGoglin","followers_url":"https://api.github.com/users/DavisGoglin/followers","following_url":"https://api.github.com/users/DavisGoglin/following{/other_user}","gists_url":"https://api.github.com/users/DavisGoglin/gists{/gist_id}","starred_url":"https://api.github.com/users/DavisGoglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavisGoglin/subscriptions","organizations_url":"https://api.github.com/users/DavisGoglin/orgs","repos_url":"https://api.github.com/users/DavisGoglin/repos","events_url":"https://api.github.com/users/DavisGoglin/events{/privacy}","received_events_url":"https://api.github.com/users/DavisGoglin/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T00:42:06Z","updated_at":"2016-03-15T00:42:06Z","body":"It's pretty stupid of me to not have done that in the first place. I still have to write documentation.\r\n\r\nIt also wouldn't hurt in the future to use the config file elsewhere, it's a pretty simple 50 lines with error handling. I wasn't sure which dir to check in, so I went for a shotgun approach. "}}