{"action":"created","issue":{"url":"https://api.github.com/repos/scheibler/khard/issues/52","repository_url":"https://api.github.com/repos/scheibler/khard","labels_url":"https://api.github.com/repos/scheibler/khard/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/scheibler/khard/issues/52/comments","events_url":"https://api.github.com/repos/scheibler/khard/issues/52/events","html_url":"https://github.com/scheibler/khard/pull/52","id":134796332,"number":52,"title":"Move subcommand handling to argparse.","user":{"login":"lucc","id":1104419,"avatar_url":"https://avatars.githubusercontent.com/u/1104419?v=3","gravatar_id":"","url":"https://api.github.com/users/lucc","html_url":"https://github.com/lucc","followers_url":"https://api.github.com/users/lucc/followers","following_url":"https://api.github.com/users/lucc/following{/other_user}","gists_url":"https://api.github.com/users/lucc/gists{/gist_id}","starred_url":"https://api.github.com/users/lucc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucc/subscriptions","organizations_url":"https://api.github.com/users/lucc/orgs","repos_url":"https://api.github.com/users/lucc/repos","events_url":"https://api.github.com/users/lucc/events{/privacy}","received_events_url":"https://api.github.com/users/lucc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-02-19T07:30:43Z","updated_at":"2016-02-28T19:04:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scheibler/khard/pulls/52","html_url":"https://github.com/scheibler/khard/pull/52","diff_url":"https://github.com/scheibler/khard/pull/52.diff","patch_url":"https://github.com/scheibler/khard/pull/52.patch"},"body":"The idea behind this is that we can get detailed help messages from argparse and that we can tell argparse to accept different options for different subcommands.  So in the end I hope to reduce the command line parsing and validating logic in main() and get a nicer command line interface.\r\n\r\nAre you interested in merging this?  (I open this PR early in order to get feedback and start a discussion, the work is not done yet.)\r\n\r\nTODO:\r\n\r\n- [x] move parsing of actions to subparsers\r\n- [x] add help for subparsers\r\n- [x] only accept valid options with different subparsers (partly done)\r\n- [ ] use a function for each subcommand to clearly separate the logic of the different subcommands (this will most likely change the command line interface a little)\r\n  - [x] `email`\r\n  - [x] `phone`\r\n  - [x] `new`\r\n  - [x] `add-email`\r\n  - [x] `modify`\r\n  - [x] `copy`\r\n  - [x] `move`\r\n  - [x] `list`\r\n  - [x] `source`\r\n  - [ ] `export`\r\n  - [ ] `details`\r\n  - [x] `merge`\r\n  - [x] `remove`\r\n- [ ] maybe more ...\r\n\r\nBUGS:\r\n- [x] it is not possible to run khard without a subcommand"},"comment":{"url":"https://api.github.com/repos/scheibler/khard/issues/comments/189923505","html_url":"https://github.com/scheibler/khard/pull/52#issuecomment-189923505","issue_url":"https://api.github.com/repos/scheibler/khard/issues/52","id":189923505,"user":{"login":"scheibler","id":8417416,"avatar_url":"https://avatars.githubusercontent.com/u/8417416?v=3","gravatar_id":"","url":"https://api.github.com/users/scheibler","html_url":"https://github.com/scheibler","followers_url":"https://api.github.com/users/scheibler/followers","following_url":"https://api.github.com/users/scheibler/following{/other_user}","gists_url":"https://api.github.com/users/scheibler/gists{/gist_id}","starred_url":"https://api.github.com/users/scheibler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scheibler/subscriptions","organizations_url":"https://api.github.com/users/scheibler/orgs","repos_url":"https://api.github.com/users/scheibler/repos","events_url":"https://api.github.com/users/scheibler/events{/privacy}","received_events_url":"https://api.github.com/users/scheibler/received_events","type":"User","site_admin":false},"created_at":"2016-02-28T19:04:50Z","updated_at":"2016-02-28T19:04:50Z","body":"Yes, optional arguments always require quoting (as far as I know). So the value for the\n--target-contact must be a single arg. Then you can use many arguments for the source contact search\nwithout problems, cause it's the only positional argument left. So john smith doesn't require\nquotes.\n\n"}}