Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions absl/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,21 @@ def parse(self, arg):
sys.exit(1)


def parse_flags_with_usage(args):
def parse_flags_with_usage(args, known_only=False):
"""Tries to parse the flags, print usage, and exit if unparseable.

Args:
args: [str], a non-empty list of the command line arguments including
program name.
known_only: bool, if True, parse and remove known flags; return the rest
untouched. Unknown flags specified by --undefok are not returned.

Returns:
[str], a non-empty list of remaining command line arguments after parsing
flags, including program name.
"""
try:
return FLAGS(args)
return FLAGS(args, known_only=known_only)
except flags.Error as error:
sys.stderr.write('FATAL Flags parsing error: %s\n' % error)
sys.stderr.write('Pass --helpshort or --helpfull to see help on flags.\n')
Expand Down