{"action":"created","issue":{"url":"https://api.github.com/repos/datalad/datalad/issues/210","labels_url":"https://api.github.com/repos/datalad/datalad/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/datalad/datalad/issues/210/comments","events_url":"https://api.github.com/repos/datalad/datalad/issues/210/events","html_url":"https://github.com/datalad/datalad/issues/210","id":106663061,"number":210,"title":"bash/zsh completions","user":{"login":"yarikoptic","id":39889,"avatar_url":"https://avatars.githubusercontent.com/u/39889?v=3","gravatar_id":"","url":"https://api.github.com/users/yarikoptic","html_url":"https://github.com/yarikoptic","followers_url":"https://api.github.com/users/yarikoptic/followers","following_url":"https://api.github.com/users/yarikoptic/following{/other_user}","gists_url":"https://api.github.com/users/yarikoptic/gists{/gist_id}","starred_url":"https://api.github.com/users/yarikoptic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarikoptic/subscriptions","organizations_url":"https://api.github.com/users/yarikoptic/orgs","repos_url":"https://api.github.com/users/yarikoptic/repos","events_url":"https://api.github.com/users/yarikoptic/events{/privacy}","received_events_url":"https://api.github.com/users/yarikoptic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/datalad/datalad/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-15T22:44:40Z","updated_at":"2015-09-16T14:48:58Z","closed_at":null,"body":"I guess we could do it manually but quick search brought me to  https://argcomplete.readthedocs.org which seems to be quite neat:\r\nfollowing minimal intrusion:\r\n\r\n```\r\n$> git diff\r\ndiff --git a/datalad/cmdline/main.py b/datalad/cmdline/main.py\r\nindex 5c4c88a..5e5de9a 100644\r\n--- a/datalad/cmdline/main.py\r\n+++ b/datalad/cmdline/main.py\r\n@@ -10,7 +10,7 @@\r\n \r\n __docformat__ = 'restructuredtext'\r\n \r\n-\r\n+import argcomplete\r\n import argparse\r\n import logging\r\n import sys\r\n@@ -172,6 +172,7 @@ def generate_api_call(cmdlineargs=None):\r\n \r\n def main(cmdlineargs=None):\r\n     parser = setup_parser()\r\n+    argcomplete.autocomplete(parser)\r\n     # parse cmd args\r\n     cmdlineargs = parser.parse_args(cmdlineargs)\r\n     # run the function associated with the selected command\r\n```\r\n\r\npros: allows to define extended completions (e.g. handles, collections) within python code itself.  Should generally be more homogeneous with the rest\r\n\r\ncons: additional 3rd party dependence (present in Debian/ubuntus), requires its own installation within completions system\r\n"},"comment":{"url":"https://api.github.com/repos/datalad/datalad/issues/comments/140764370","html_url":"https://github.com/datalad/datalad/issues/210#issuecomment-140764370","issue_url":"https://api.github.com/repos/datalad/datalad/issues/210","id":140764370,"user":{"login":"hanke","id":136479,"avatar_url":"https://avatars.githubusercontent.com/u/136479?v=3","gravatar_id":"","url":"https://api.github.com/users/hanke","html_url":"https://github.com/hanke","followers_url":"https://api.github.com/users/hanke/followers","following_url":"https://api.github.com/users/hanke/following{/other_user}","gists_url":"https://api.github.com/users/hanke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanke/subscriptions","organizations_url":"https://api.github.com/users/hanke/orgs","repos_url":"https://api.github.com/users/hanke/repos","events_url":"https://api.github.com/users/hanke/events{/privacy}","received_events_url":"https://api.github.com/users/hanke/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T14:48:58Z","updated_at":"2015-09-16T14:48:58Z","body":"I implemented minimal support and install in Debian.\nOn Sep 16, 2015 4:22 PM, \"Yaroslav Halchenko\" <notifications@github.com>\nwrote:\n\n> starcluster (btw -- they apparently have similar to our system, just no\n> \"Python API\" generation, but with shortcut aliases for commands etc), and\n> uses similar (which inspired this one) module -- optcomplete (for optparse)\n> but that one doesn't require any \"global\" enabling shim, so startcluster's\n> completion setup for a user is just a single tiny file to source...\n> so I guess we just need a closer look into this beast on how to make it\n> easier to \"deploy\" for the user, but indeed probably is the way to go and\n> indeed those 2 lines changes is enough to start but then Python code should\n> provide additional goodies may be even linked into Constraints system\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/datalad/datalad/issues/210#issuecomment-140756205>.\n>\n"}}