grit: handle invalid command line options better

Currently when passing unknown options, we get a traceback:
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/grit", line 15, in <module>
    grit.grit_runner.Main(sys.argv[1:])
  File "/usr/lib64/python2.7/site-packages/grit/grit_runner.py", line 229, in Main
    args = options.ReadOptions(args)  # args may be shorter after this
  File "/usr/lib64/python2.7/site-packages/grit/grit_runner.py", line 167, in ReadOptions
    (opts, args) = getopt.getopt(args, 'g:qdvxc:i:p:h:', ('psyco',))
  File "/usr/lib64/python2.7/getopt.py", line 90, in getopt
    opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
  File "/usr/lib64/python2.7/getopt.py", line 190, in do_shorts
    if short_has_arg(opt, shortopts):
  File "/usr/lib64/python2.7/getopt.py", line 206, in short_has_arg
    raise GetoptError('option -%s not recognized' % opt, opt)
getopt.GetoptError: option -a not recognized

This is a lot of noise except for the final line.  This can be even
harder when grit doesn't have standard -h (help) options.  Issue a
normal error message so it's clear to users what's wrong.

Bug: 747171
Change-Id: If3989f54e16e7952d872f5f19a97a0cbd2c1f4c7
Reviewed-on: https://chromium-review.googlesource.com/c/1319171
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#605793}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 59a2577cc4cf6eff9d903e504da722c7ce92df16
1 file changed