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