• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:error +full:- +full:exitcode

7 #      http://www.apache.org/licenses/LICENSE-2.0
22 raise app.UsageError('Too many command-line arguments.')
57 'Dump profile information to a file (for python -m '
58 'pstats). Implies --run_with_profiling.')
62 '--run_with_profiling is set.')
73 class Error(Exception): class
77 class UsageError(Error):
82 flags have been supplied or when there are not enough non-flag
83 arguments. It is distinct from flags.Error which covers the lower
87 def __init__(self, message, exitcode=1): argument
89 self.exitcode = exitcode
105 # Advertise --helpfull on stdout, since usage() was on stdout.
107 print('Try --helpfull to get a list of all flags.')
112 """--helpshort is an alias for --help."""
135 'helpxml', False, 'like --helpfull, but generates XML output',
148 args: [str], a non-empty list of the command line arguments including
152 [str], a non-empty list of remaining command line arguments after parsing
157 except flags.Error as error:
158 message = str(error)
160 final_message = 'FATAL Flags parsing error:\n%s\n' % textwrap.indent(
163 final_message = 'FATAL Flags parsing error: %s\n' % message
165 sys.stderr.write('Pass --helpshort or --helpfull to see help on flags.\n')
179 flags.DEFINE_flag(HelpshortFlag()) # alias for --help
191 This also calls sys.exit(0) if flag --only_check_args is True.
194 argv: [str], a non-empty list of the command line arguments including
203 [str], a non-empty list of remaining command line arguments after parsing
207 Error: Raised when flags_parser is called, but FLAGS is not parsed.
218 raise Error('FLAGS must be parsed after flags_parser is called.')
239 # Avoid import overhead since most apps (including performance-sensitive
263 except: # pylint: disable=bare-except
267 logging.error(traceback.format_exc())
268 except: # pylint: disable=bare-except
287 argv: A non-empty list of the command line arguments including program name,
292 Should be passed as a keyword-only arg which will become mandatory in a
294 - Parses command line flags with the flag module.
295 - If there are any errors, prints usage().
296 - Calls main() with the remaining arguments.
297 - If main() raises a UsageError, prints usage and the error message.
309 except UsageError as error:
310 usage(shorthelp=True, detailed_error=error, exitcode=error.exitcode)
313 # Don't try to post-mortem debug successful SystemExits, since those
314 # mean there wasn't actually an error. In particular, the test framework
320 # non-interactive scenario.
324 print(' *** Entering post-mortem debugging ***')
363 """Does one-time initialization and re-parses flags on rerun."""
376 except Exception: # pylint: disable=broad-except
378 # Disabled faulthandler is a low-impact error.
388 exitcode=None): argument
397 exitcode: optional integer, if set, exits with this status code after
411 num_specifiers = doc.count('%') - 2 * doc.count('%%')
415 # Just display the docstring as-is.
431 # "foo.par --help | less" is a frequent use case.
434 if exitcode is not None:
435 sys.exit(exitcode)