34 from optparse
import OptionParser, IndentedHelpFormatter
35 from rosgraph.names
import load_mappings, REMAP
36 from .color
import colorize
41 OptionParser.error(self, msg)
44 _original_wrap = textwrap.wrap
47 for paragraph
in text.split(
'\n'):
53 IndentedHelpFormatter.__init__(self, *args, **kwargs)
56 textwrap.wrap, old = wrap_with_newlines, textwrap.wrap
57 result = IndentedHelpFormatter.format_option(self, text)
65 parser.add_option(
"-o", dest=
"output", metavar=
"FILE",
66 help=
"write output to FILE instead of stdout")
67 parser.add_option(
"--oldorder", action=
"store_false", dest=
"in_order",
68 help=
"use traditional processing order [deprecated default]")
69 parser.add_option(
"--inorder",
"-i", action=
"store_true", dest=
"in_order",
70 help=
"use processing in read order")
71 parser.add_option(
"--check-order", action=
"store_true", dest=
"do_check_order",
72 help=
"check document for inorder processing", default=
False)
74 parser.add_option(
"--deps", action=
"store_true", dest=
"just_deps",
75 help=
"print file dependencies")
76 parser.add_option(
"--includes", action=
"store_true", dest=
"just_includes",
77 help=
"only process includes")
78 parser.add_option(
"--xacro-ns", action=
"store_false", default=
True, dest=
"xacro_ns",
79 help=
"require xacro namespace prefix for xacro tags")
82 parser.add_option(
"-q", action=
"store_const", dest=
"verbosity", const=0,
83 help=
"quiet operation suppressing warnings")
84 parser.add_option(
"-v", action=
"count", dest=
"verbosity",
85 help=
"increase verbosity")
86 parser.add_option(
"--verbosity", metavar=
'level', dest=
"verbosity", type=
'int',
87 help=textwrap.dedent(
"""\ 89 0: quiet, suppressing warnings 90 1: default, showing warnings and error locations 92 3: log property definitions and usage on top level 93 4: log property definitions and usage on all levels"""))
96 mappings = load_mappings(argv)
98 parser.set_defaults(in_order=
False, just_deps=
False, just_includes=
False,
100 filtered_args = [a
for a
in argv
if REMAP
not in a]
101 (options, pos_args) = parser.parse_args(filtered_args)
105 if options.in_order
and options.just_includes:
106 parser.error(
"options --inorder and --includes are mutually exclusive")
108 if options.do_check_order:
109 options.in_order =
True 111 if len(pos_args) != 1:
113 parser.error(
"expected exactly one input file as argument")
117 options.mappings = mappings
118 return options, pos_args[0]
def wrap_with_newlines(text, width, kwargs)
def process_args(argv, require_input=True)
def colorize(msg, color, file=sys.stderr, alt_text=None)