If you add an invalid flag (such as --drifting) to the default command line at http://try.docopt.org/,
there is no error message as such, just a usage message.
Docopt could do better here, perhaps by reporting which thing it was trying to match at the time and the invalid part.
Agree. That is definitely a TODO. And should be quite easy—docopt knows which elements it didn't match ("left" elements).
@halst What errors do you think can occur while parsing the usage message? For example, should it complain when it fails to find "usage:"? or when program name is not consistent in different usage lines?
@johari yes, something like this. Python version already complains if there is no "usage:" or if there is more than one "usage:".
When we switch to the new grammar (#104) we will be able to report syntax errors as well.
On the same topic, I think the "Unrecognized option" primitive should be extended to commands and arguments.
Wouldn't it be nice too to make a choice about the -h, --help option?
Right now, this option is valid but does not appear in the command line if programmer didn't write it.
Don't you think it's a bit obscure and docopt should either automatically add this option or do not provide it at all if the user didn't write it down?
@benoistlaurent agree, this is on my todo-list. Next release will be non-backwards-compatible, so this change should be fine.