{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13743","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13743/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13743/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13743/events","html_url":"https://github.com/ansible/ansible/issues/13743","id":125291115,"number":13743,"title":"'ansible-galaxy install' is completely unusable when any flags are passed","user":{"login":"habnabit","id":21168,"avatar_url":"https://avatars.githubusercontent.com/u/21168?v=3","gravatar_id":"","url":"https://api.github.com/users/habnabit","html_url":"https://github.com/habnabit","followers_url":"https://api.github.com/users/habnabit/followers","following_url":"https://api.github.com/users/habnabit/following{/other_user}","gists_url":"https://api.github.com/users/habnabit/gists{/gist_id}","starred_url":"https://api.github.com/users/habnabit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/habnabit/subscriptions","organizations_url":"https://api.github.com/users/habnabit/orgs","repos_url":"https://api.github.com/users/habnabit/repos","events_url":"https://api.github.com/users/habnabit/events{/privacy}","received_events_url":"https://api.github.com/users/habnabit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-06T23:55:29Z","updated_at":"2016-01-07T00:05:31Z","closed_at":null,"body":"**Issue Type:** Bug Report\r\n\r\n**Ansible Version:** 2.0.0. The bug was introduced in 21775d7866c7953d4d953c271c0a18e227e4bc66, and is still present in fcd074d40f32ef52ed286678293984125ff51008, which is the version I discovered it in.\r\n\r\n**Ansible Configuration:** None. This occurs before I can even get to running `ansible-playbook` at all, as `ansible-galaxy` is failing to do anything.\r\n\r\n**Environment:** Discovered on ubuntu 14.04; verified and git-bisected on OS X 10.11.\r\n\r\n**Summary:**\r\n\r\n`ansible-galaxy install` (and presumably other subcommands too) no longer accepts any flags.\r\n\r\n**Steps To Reproduce:**\r\n\r\n`ansible-galaxy install -f`\r\n\r\n**Expected Results:**\r\n\r\n```\r\nUsage: ansible-galaxy install [options] [-r FILE | role_name(s)[,version] | scm+role_repo_url[,version] | tar_file(s)]\r\n\r\nOptions:\r\n  -f, --force           Force overwriting an existing role\r\n  -h, --help            show this help message and exit\r\n  -c, --ignore-certs    Ignore SSL certificate validation errors.\r\n  -i, --ignore-errors   Ignore errors and continue with the next specified\r\n                        role.\r\n  -n, --no-deps         Don't download roles listed as dependencies\r\n  -r ROLE_FILE, --role-file=ROLE_FILE\r\n                        A file containing a list of roles to be imported\r\n  -p ROLES_PATH, --roles-path=ROLES_PATH\r\n                        The path to the directory containing your roles. The\r\n                        default is the roles_path configured in your\r\n                        ansible.cfg file (/etc/ansible/roles if not\r\n                        configured)\r\n  -s API_SERVER, --server=API_SERVER\r\n                        The API server destination\r\n  -v, --verbose         verbose mode (-vvv for more, -vvvv to enable\r\n                        connection debugging)\r\n  --version             show program's version number and exit\r\nERROR! - you must specify a user/role name or a roles file\r\n```\r\n\r\n**Actual Results:**\r\n\r\n```\r\nUsage: ansible-galaxy [delete|import|info|init|install|list|login|remove|search|setup] [--help] [options] ...\r\n\r\nansible-galaxy: error: no such option: -f\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/169504354","html_url":"https://github.com/ansible/ansible/issues/13743#issuecomment-169504354","issue_url":"https://api.github.com/repos/ansible/ansible/issues/13743","id":169504354,"user":{"login":"habnabit","id":21168,"avatar_url":"https://avatars.githubusercontent.com/u/21168?v=3","gravatar_id":"","url":"https://api.github.com/users/habnabit","html_url":"https://github.com/habnabit","followers_url":"https://api.github.com/users/habnabit/followers","following_url":"https://api.github.com/users/habnabit/following{/other_user}","gists_url":"https://api.github.com/users/habnabit/gists{/gist_id}","starred_url":"https://api.github.com/users/habnabit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/habnabit/subscriptions","organizations_url":"https://api.github.com/users/habnabit/orgs","repos_url":"https://api.github.com/users/habnabit/repos","events_url":"https://api.github.com/users/habnabit/events{/privacy}","received_events_url":"https://api.github.com/users/habnabit/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T00:05:31Z","updated_at":"2016-01-07T00:05:31Z","body":"It appears that the issue is that `self.parser.parse_args()` is called before `self.parser.add_option(...)` is called for subcommand-specific options. Hacking subcommands into optparse seems to be a losing prospect. I *personally* would suggest using [click](http://click.pocoo.org/6/) for argument parsing."}}