{"action":"closed","issue":{"url":"https://api.github.com/repos/mitsuhiko/click/issues/245","labels_url":"https://api.github.com/repos/mitsuhiko/click/issues/245/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/click/issues/245/comments","events_url":"https://api.github.com/repos/mitsuhiko/click/issues/245/events","html_url":"https://github.com/mitsuhiko/click/issues/245","id":48493630,"number":245,"title":"Order of options / command name seems to matter","user":{"login":"marktheunissen","id":453297,"avatar_url":"https://avatars.githubusercontent.com/u/453297?v=3","gravatar_id":"","url":"https://api.github.com/users/marktheunissen","html_url":"https://github.com/marktheunissen","followers_url":"https://api.github.com/users/marktheunissen/followers","following_url":"https://api.github.com/users/marktheunissen/following{/other_user}","gists_url":"https://api.github.com/users/marktheunissen/gists{/gist_id}","starred_url":"https://api.github.com/users/marktheunissen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marktheunissen/subscriptions","organizations_url":"https://api.github.com/users/marktheunissen/orgs","repos_url":"https://api.github.com/users/marktheunissen/repos","events_url":"https://api.github.com/users/marktheunissen/events{/privacy}","received_events_url":"https://api.github.com/users/marktheunissen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-11-12T10:14:01Z","updated_at":"2015-03-31T10:27:28Z","closed_at":"2015-03-31T10:27:28Z","body":"Hello,\r\n\r\nIf I have options, it seems to be mandatory that they appear before the command name, as putting them after triggers a 'no such option' error.\r\n\r\nTest code:\r\n\r\n```python\r\nimport click\r\n\r\n@click.group()\r\n@click.option('--abc', default=2)\r\n@click.option('--defg', default=2)\r\ndef cli(abc, defg):\r\n    click.echo('Options passed were %s / %s' % (abc,defg))\r\n\r\n@cli.command()\r\ndef sync():\r\n    click.echo('Synching')\r\n\r\nif __name__ == '__main__':\r\n    cli()\r\n```\r\n\r\nThis doesn't work:\r\n\r\n```bash\r\n$ test.py sync --defg=6\r\nOptions passed were 2 / 2\r\nError: no such option: --defg\r\n```\r\n\r\nThis works:\r\n\r\n```bash\r\n$ test.py --defg=6 sync\r\nOptions passed were 2 / 6\r\nSynching\r\n```\r\n\r\nIt may be that the options must come before the command, but then for example I see in one of the tests:\r\n\r\n```python\r\nUsage: foo test [OPTIONS]\r\n```\r\n\r\nAnd I also have received a message before saying `Usage: <script> command [OPTIONS]` where the options were listed last in the list.\r\n\r\nPerhaps just a better error message instead of `no such option`?\r\n\r\nThanks!\r\nMark"}}