code: def parse_args():
      
      threshold_choices = docutils.frontend.OptionParser.threshold_choices
  
      parser = argparse.ArgumentParser(
          description=__doc__ + (' Sphinx is enabled.'
                                 if SPHINX_INSTALLED else ''),
          prog='rstcheck')
  
      parser.add_argument('files', nargs='+', type=decode_filename,
                          help='files to check')
      parser.add_argument('--config', metavar='CONFIG', default=None,
                          help='location of config file')
      parser.add_argument('-r', '--recursive', action='store_true',
                          help='run recursively over directories')
      parser.add_argument('--report', metavar='level',
                          choices=threshold_choices,
                          default='info',
                          help='report system messages at or higher than '
                               'level; ' +
                               ', '.join(choice for choice in threshold_choices
                                         if not choice.isdigit()) +
                               ' (default: %(default)s)')
      parser.add_argument('--ignore-language', '--ignore',
                          metavar='language', default='',
                          help='comma-separated list of languages to ignore')
      parser.add_argument('--ignore-messages',
                          metavar='messages', default='',
                          help='python regex that match the messages to ignore')
      parser.add_argument('--ignore-directives',
                          metavar='directives', default='',
                          help='comma-separated list of directives to ignore')
      parser.add_argument('--ignore-substitutions',
                          metavar='substitutions', default='',
                          help='comma-separated list of substitutions to ignore')
      parser.add_argument('--ignore-roles',
                          metavar='roles', default='',
                          help='comma-separated list of roles to ignore')
      parser.add_argument('--debug', action='store_true',
                          help='show messages helpful for debugging')
      parser.add_argument('--version', action='version',
                          version='%(prog)s ' + __version__)
  
      args = parser.parse_args()
  
      if '-' in args.files:
          if len(args.files) > 1:
              parser.error("'-' for standard in can only be checked alone")
      else:
          args.files = list(find_files(filenames=args.files,
                                       recursive=args.recursive))
  
      return args
docs: Return parsed command-line arguments.