34 from optparse 
import OptionParser, IndentedHelpFormatter
 
   35 from .color 
import colorize, warning, message
 
   41         OptionParser.error(self, msg)
 
   44 _original_wrap = textwrap.wrap
 
   49     for paragraph 
in text.split(
'\n'):
 
   56         IndentedHelpFormatter.__init__(self, *args, **kwargs)
 
   59         textwrap.wrap, old = wrap_with_newlines, textwrap.wrap
 
   60         result = IndentedHelpFormatter.format_option(self, text)
 
   68     parser.add_option(
"-o", dest=
"output", metavar=
"FILE",
 
   69                       help=
"write output to FILE instead of stdout")
 
   70     parser.add_option(
"--deps", action=
"store_true", dest=
"just_deps",
 
   71                       help=
"print file dependencies")
 
   72     parser.add_option(
"--inorder", 
"-i", action=
"store_true", dest=
"in_order",
 
   73                       help=
"processing in read order (default, can be omitted)")
 
   76     parser.add_option(
"-q", action=
"store_const", dest=
"verbosity", const=0,
 
   77                       help=
"quiet operation, suppressing warnings")
 
   78     parser.add_option(
"-v", action=
"count", dest=
"verbosity",
 
   79                       help=
"increase verbosity")
 
   80     parser.add_option(
"--verbosity", metavar=
'level', dest=
"verbosity", type=
'int',
 
   81                       help=textwrap.dedent(
"""\ 
   83                       0: quiet, suppressing warnings 
   84                       1: default, showing warnings and error locations 
   86                       3: log property definitions and usage on top level 
   87                       4: log property definitions and usage on all levels"""))
 
   91         from rosgraph.names 
import load_mappings, REMAP
 
   92         mappings = load_mappings(argv)
 
   93         filtered_args = [a 
for a 
in argv 
if REMAP 
not in a]  
 
   94     except ImportError 
as e:
 
   99     parser.set_defaults(just_deps=
False, just_includes=
False, verbosity=1)
 
  100     (options, pos_args) = parser.parse_args(filtered_args)
 
  102         message(
"xacro: in-order processing became default in ROS Melodic. You can drop the option.")
 
  103     options.in_order = 
True 
  105     if len(pos_args) != 1:
 
  107             parser.error(
"expected exactly one input file as argument")
 
  111     options.mappings = mappings
 
  112     return options, pos_args[0]