Entry point for command line script to perform OAuth 2.0.

def main(argv):
  """Entry point for command line script to perform OAuth 2.0."""
  p = argparse.ArgumentParser()
  p.add_argument('-s', '--scope', nargs='+')
  p.add_argument('-o', '--oauth-service', default='google')
  p.add_argument('-i', '--client-id')
  p.add_argument('-x', '--client-secret')
  p.add_argument('-r', '--redirect-uri')
  p.add_argument('-f', '--client-secrets')
  args = p.parse_args(argv)
  client_args = (args.client_id, args.client_secret, args.client_id)
  if any(client_args) and not all(client_args):
    print('Must provide none of client-id, client-secret and redirect-uri;'
          ' or all of them.')
    p.print_usage()
    return 1
  print args.scope
  if not args.scope:
    print('Scope must be provided.')
    p.print_usage()
    return 1
  config = WizardClientConfig()
  config.scope = ' '.join(args.scope)
  print(run_local(UserOAuth2(config))['access_token'])
  return 0