Parse command-line arguments
179904
def parse_args():
    """"""
    prog = 'github-tag-release'

    parser = argparse.ArgumentParser(
        prog=prog,
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=textwrap.dedent("""
            Tag git repositories, in a GitHub org, that correspond to the
            products in a published eups distrib tag.

            Examples:

                # eups tag is derived from git tag
                {prog} \\
                    --dry-run \\
                    --debug \\
                    --limit 10 \\
                    --org lsst \\
                    --allow-team 'Data Management' \\
                    --allow-team 'DM Externals' \\
                    'w.2018.18' 'b3595'

                # explicit eups tag and git tag
                {prog} \\
                    --dry-run \\
                    --debug \\
                    --limit 10 \\
                    --org lsst \\
                    --allow-team 'Data Management' \\
                    --allow-team 'DM Externals' \\
                    --external-team 'DM Externals' \\
                    --eups-tag v11_0_rc2 \\
                    11.0.rc2 b1679

                # verify a past eups tag + git tag release
                {prog} \\
                    --verify \\
                    --debug \\
                    --limit 10 \\
                    --org 'lsst' \\
                    --allow-team 'Data Management' \\
                    --allow-team 'DM Externals' \\
                    --external-team 'DM Externals' \\
                    --deny-team 'DM Auxilliaries' \\
                    --email 'sqre-admin@lists.lsst.org' \\
                    --user 'sqreadmin' \\
                    --token "$GITHUB_TOKEN" \\
                    --ignore-git-tagger \\
                    --ignore-git-message \\
                    --manifest 'b3595' \\
                    'w.2018.18'

                # tag a git release from a manifest *without* a pre-existing
                # eups tag.
                {prog} \\
                    --dry-run \\
                    --debug \\
                    --limit 10 \\
                    --org 'lsst' \\
                    --allow-team 'Data Management' \\
                    --allow-team 'DM Externals' \\
                    --external-team 'DM Externals' \\
                    --deny-team 'DM Auxilliaries' \\
                    --email 'sqre-admin@lists.lsst.org' \\
                    --user 'sqreadmin' \\
                    --token "$GITHUB_TOKEN" \\
                    --ignore-git-tagger \\
                    --ignore-git-message \\
                    --manifest 'b3595' \\
                    --manifest-only \\
                    'w.2018.18'

            Note that the access token must have access to these oauth scopes:
                * read:org
                * repo

            The token generated by `github-auth --user` should have sufficient
            permissions.
        """).format(prog=prog),
        epilog='Part of codekit: https://github.com/lsst-sqre/sqre-codekit'
    )

    parser.add_argument(
        '--manifest',
        required=True,
        help='Name of versiondb manifest for git repo sha resolution'
             ' AKA bNNNN')
    parser.add_argument(
        '--org',
        required=True,
        help='Github organization')
    parser.add_argument(
        '--allow-team',
        action='append',
        required=True,
        help='git repos to be tagged MUST be a member of ONE or more of'
             ' these teams (can specify several times)')
    parser.add_argument(
        '--external-team',
        action='append',
        help='git repos in this team MUST not have tags that start with a'
             ' number. Any requested tag that violates this policy will be'
             ' prefixed with \'v\' (can specify several times)')
    parser.add_argument(
        '--deny-team',
        action='append',
        help='git repos to be tagged MUST NOT be a member of ANY of'
             ' these teams (can specify several times)')
    parser.add_argument(
        '--user',
        help='Name of person making the tag - defaults to gitconfig value')
    parser.add_argument(
        '--email',
        help='Email address of tagger - defaults to gitconfig value')
    parser.add_argument(
        '--token-path',
        default='~/.sq_github_token_delete',
        help='Use a token (made with github-auth) in a non-standard location')
    parser.add_argument(
        '--token',
        default=None,
        help='Literal github personal access token string')
    parser.add_argument(
        '--versiondb-base-url',
        default=os.getenv('LSST_VERSIONDB_BASE_URL'),
        help='Override the default versiondb base url')
    parser.add_argument(
        '--eupstag-base-url',
        default=os.getenv('LSST_EUPSTAG_BASE_URL'),
        help='Override the default eupstag base url')
    parser.add_argument(
        '--force-tag',
        action='store_true',
        help='Force moving pre-existing annotated git tags.')
    parser.add_argument(
        '--ignore-manifest-versions',
        action='store_true',
        help='Ignore manifest version strings'
             ' when cross referencing eups tag and manifest data.')
    parser.add_argument(
        '--ignore-git-message',
        action='store_true',
        help='Ignore git tag message when verifying an existing tag.')
    parser.add_argument(
        '--ignore-git-tagger',
        action='store_true',
        help='Ignore git tag "tagger"/author when verifying an existing tag.')
    parser.add_argument(
        '--limit',
        default=None,
        type=int,
        help='Maximum number of products/repos to tags. (useful for testing)')
    parser.add_argument(
        '--fail-fast',
        action='store_true',
        help='Fail immediately on github API error.')
    parser.add_argument(
        '--no-fail-fast',
        action='store_const',
        const=False,
        dest='fail_fast',
        help='DO NOT Fail immediately on github API error(s). (default)')
    parser.add_argument(
        '-d', '--debug',
        action='count',
        default=codetools.debug_lvl_from_env(),
        help='Debug mode (can specify several times)')
    parser.add_argument('-v', '--version', action=codetools.ScmVersionAction)
    parser.add_argument('tag')

    manifest_group = parser.add_mutually_exclusive_group()
    manifest_group.add_argument(
        '--eups-tag',
        help='(mutually exclusive with --manifest-only)')
    manifest_group.add_argument(
        '--manifest-only',
        action='store_true',
        help='Do not cross reference a published eups tag with the manifest'
             ' -- use only the metadata from the manifest to determine'
             ' git tag location.'
             ' This allows a git tag to be created without a prior eups tag.'
             ' (mutually exclusive with --eups-tag)')

    dryrun_group = parser.add_mutually_exclusive_group()
    dryrun_group.add_argument(
        '--dry-run',
        action='store_true',
        help='Do not create/update tag(s) or modify any state.'
             ' (mutually exclusive with --verify)')
    dryrun_group.add_argument(
        '--verify',
        action='store_true',
        help='Verify that all git tags for a release are present and correct.'
             ' will not create/update tag(s) or modify any state.'
             ' (mutually exclusive with --dry-run)')

    return parser.parse_args()
227626
def parse_args(args):
    
    index = None
    for arg_i, arg in enumerate(args):
        if not arg.startswith('-'):
            index = arg_i
            break

    # Unable to parse any arguments
    if index is None:
        return (args, None, [])

    return (args[:index], args[index], args[(index + 1):])
502789
def _parse_arguments(arguments=None):
    """"""
    dir_hash = hashlib.sha1(os.getcwd().encode("utf-8")).hexdigest()

    parser = argparse.ArgumentParser(description="""Lint for Polysquare style guide""")
    parser.add_argument("--checks",
                        nargs=0,
                        action=ShowAvailableChecksAction,
                        help="""list available checks""")
    parser.add_argument("files",
                        nargs="*",
                        metavar=("FILE"),
                        help="""read FILE""",
                        type=str)
    parser.add_argument("--whitelist",
                        nargs="*",
                        help="""list of checks that should only be run""",
                        default=None)
    parser.add_argument("--blacklist",
                        nargs="*",
                        help="""list of checks that should never be run""",
                        default=None)
    parser.add_argument("--fix-what-you-can",
                        action="store_const",
                        help="""fix errors automatically""",
                        const=True)
    parser.add_argument("--spellcheck-cache",
                        help="""path to spell-checking cache file""",
                        default=None)
    parser.add_argument("--log-technical-terms-to",
                        help="""path to file to log technical terms to""",
                        default=None)
    parser.add_argument("--stamp-file-path",
                        help="""path to directory to store cached results""",
                        default=os.path.join(tempfile.gettempdir(),
                                             "jobstamps",
                                             "spellcheck_linter",
                                             dir_hash))
    parser.add_argument("--block-regexps",
                        help="""Regular expressions to exclude from all checks.""",
                        nargs="*",
                        default=None)

    return parser.parse_args(arguments)
1221945
def parse_args(args=sys.argv[1:]):
    
    parser = argparse.ArgumentParser()
    parser.add_argument('-a', '--address', help='address to listen on, default localhost',
                                default='localhost')
    parser.add_argument('-p', '--port', help='port to listen on, default 1234',
                                default=1234, type=int)
    parser.add_argument('-d', '--directory', help='directory to serve, default .',
                                default='.')
    parser.add_argument('-n', '--noindex', help='do not show directory indexes',
                                default=False, action='store_true')
    loglevel = parser.add_mutually_exclusive_group()
    loglevel.add_argument('-v', '--verbose', help='verbose logging',
                                default=False, action='store_true')
    loglevel.add_argument('-q', '--quiet', help='quiet logging',
                                default=False, action='store_true')
    return parser.parse_args(args)
229769
def parse_from_args(self, l):
        """"""
        if self.multiple:
            return [self.parse_from_arg(arg) for arg in l]
        return self.parse_from_arg(l[0])
1363817
def parse_args(args):
    
    parser = argparse.ArgumentParser(
        description="Just a Hello World demonstration")
    parser.add_argument(
        '-v',
        '--version',
        action='version',
        version='twip {ver}'.format(ver=__version__))
    return parser.parse_args(args)
897287
def parse_args(argv=None):
    """"""
    parser = ArgumentParser()
    parser.add_argument('--password', dest="password", type=str)
    parser.add_argument('--user', dest="user", type=str)
    parser.add_argument('--config-file', dest="config_file", type=str)

    options = parser.parse_args(argv)
    return options
1348575
def parse_args(self):
        
        parser = ArgumentParser(description='',
                                formatter_class=RawTextHelpFormatter)
        parser.add_argument("--generate", action="store", dest='generate',
                            choices=['command', 'docker-run', 'docker-compose',
                                     'ini', 'env', 'kubernetes', 'readme', 'drone-plugin'],
                            help="Generate a template ")
        parser.add_argument("--settings", action="store", dest='settings',
                            help="Specify a settings file. (ie settings.dev)")
        for key, value in self.spec.items():
            if value['type'] in [str, int, float]:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=value['type'],
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == bool:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=lambda x:bool(strtobool(x)),
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == list:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    nargs='+',
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == dict:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=json.loads,
                                    choices=value.get("choices"),
                                    help=self.help(value))
        args, _unknown = parser.parse_known_args()
        return args
682750
def parse(cmdline = ARGV)
    vals = {}
    required = {}

    opt :version, "Print version and exit" if @version && ! (@specs[:version] || @long["version"])
    opt :help, "Show this message" unless @specs[:help] || @long["help"]

    @specs.each do |sym, opts|
      required[sym] = true if opts[:required]
      vals[sym] = opts[:default]
      vals[sym] = [] if opts[:multi] && !opts[:default] # multi arguments default to [], not nil
    end

    resolve_default_short_options!

    ## resolve symbols
    given_args = {}
    @leftovers = each_arg cmdline do |arg, params|
      ## handle --no- forms
      arg, negative_given = if arg =~ /^--no-([^-]\S*)$/
        ["--#{$1}", true]
      else
        [arg, false]
      end

      sym = case arg
        when /^-([^-])$/      then @short[$1]
        when /^--([^-]\S*)$/  then @long[$1] || @long["no-#{$1}"]
        else                       raise CommandlineError, "invalid argument syntax: '#{arg}'"
      end

      sym = nil if arg =~ /--no-/ # explicitly invalidate --no-no- arguments

      next 0 if ignore_invalid_options && !sym
      raise CommandlineError, "unknown argument '#{arg}'" unless sym

      if given_args.include?(sym) && !@specs[sym][:multi]
        raise CommandlineError, "option '#{arg}' specified multiple times"
      end

      given_args[sym] ||= {}
      given_args[sym][:arg] = arg
      given_args[sym][:negative_given] = negative_given
      given_args[sym][:params] ||= []

      # The block returns the number of parameters taken.
      num_params_taken = 0

      unless params.nil?
        if SINGLE_ARG_TYPES.include?(@specs[sym][:type])
          given_args[sym][:params] << params[0, 1]  # take the first parameter
          num_params_taken = 1
        elsif MULTI_ARG_TYPES.include?(@specs[sym][:type])
          given_args[sym][:params] << params        # take all the parameters
          num_params_taken = params.size
        end
      end

      num_params_taken
    end

    ## check for version and help args
    raise VersionNeeded if given_args.include? :version
    raise HelpNeeded if given_args.include? :help

    ## check constraint satisfaction
    @constraints.each do |type, syms|
      constraint_sym = syms.find { |sym| given_args[sym] }
      next unless constraint_sym

      case type
      when :depends
        syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} requires --#{@specs[sym][:long]}" unless given_args.include? sym }
      when :conflicts
        syms.each { |sym| raise CommandlineError, "--#{@specs[constraint_sym][:long]} conflicts with --#{@specs[sym][:long]}" if given_args.include?(sym) && (sym != constraint_sym) }
      end
    end

    required.each do |sym, val|
      raise CommandlineError, "option --#{@specs[sym][:long]} must be specified" unless given_args.include? sym
    end

    ## parse parameters
    given_args.each do |sym, given_data|
      arg, params, negative_given = given_data.values_at :arg, :params, :negative_given

      opts = @specs[sym]
      if params.empty? && opts[:type] != :flag
        raise CommandlineError, "option '#{arg}' needs a parameter" unless opts[:default]
        params << (opts[:default].kind_of?(Array) ? opts[:default].clone : [opts[:default]])
      end

      vals["#{sym}_given".intern] = true # mark argument as specified on the commandline

      case opts[:type]
      when :flag
        vals[sym] = (sym.to_s =~ /^no_/ ? negative_given : !negative_given)
      when :int, :ints
        vals[sym] = params.map { |pg| pg.map { |p| parse_integer_parameter p, arg } }
      when :float, :floats
        vals[sym] = params.map { |pg| pg.map { |p| parse_float_parameter p, arg } }
      when :string, :strings
        vals[sym] = params.map { |pg| pg.map(&:to_s) }
      when :io, :ios
        vals[sym] = params.map { |pg| pg.map { |p| parse_io_parameter p, arg } }
      when :date, :dates
        vals[sym] = params.map { |pg| pg.map { |p| parse_date_parameter p, arg } }
      end

      if SINGLE_ARG_TYPES.include?(opts[:type])
        if opts[:multi]       # multiple options, each with a single parameter
          vals[sym] = vals[sym].map { |p| p[0] }
        else                  # single parameter
          vals[sym] = vals[sym][0][0]
        end
      elsif MULTI_ARG_TYPES.include?(opts[:type]) && !opts[:multi]
        vals[sym] = vals[sym][0]  # single option, with multiple parameters
      end
      # else: multiple options, with multiple parameters

      opts[:callback].call(vals[sym]) if opts.key?(:callback)
    end

    ## modify input in place with only those
    ## arguments we didn't process
    cmdline.clear
    @leftovers.each { |l| cmdline << l }

    ## allow openstruct-style accessors
    class << vals
      def method_missing(m, *_args)
        self[m] || self[m.to_s]
      end
    end
    vals
  end
604074
def parse_args(args=None):
    """"""
    # The argparse module provides a nice abstraction for argument parsing.
    # It automatically builds up the help text, too.
    parser = argparse.ArgumentParser(
            prog=__package__,
            description='Make substitutions in text files.',
        )
    parser.add_argument('-V', '--version',
                        action='version',
                        version="%%(prog)s %s" % (__version__,),
                        )

    group = parser.add_argument_group("Engine")
    group.add_argument('-e', '--engine',
                       dest='engine',
                       default='string.Template',
                       help="templating engine",
                       metavar="ENGINE",
                       )
    group.add_argument('-t', '--tolerant',
                       action='store_true',
                       dest='tolerant',
                       help="don't fail on missing names",
                       )

    group = parser.add_argument_group("Output")
    group.add_argument('-s', '--stdout',
                       action='append_const',
                       dest='outfiles',
                       const=sys.stdout,
                       help="use standard output",
                       )
    group.add_argument('-o', '--outfile',
                       action='append',
                       dest='outfiles',
                       help="output file",
                       metavar="FILE",
                       )
    group.add_argument('--vary',
                       action='store_true',
                       dest='vary',
                       help="vary output file name according to template",
                       )
    group.add_argument('-r', '--read-old',
                       action='store_true',
                       dest='read_old',
                       help="read preexisting output files and"
                            "hand the respective content to the template",
                       )
    group.add_argument('-d', '--delete-empty',
                       action='store_true',
                       dest='delete_empty',
                       help="delete file if output is empty",
                       )

    group = parser.add_argument_group("Input")
    group.add_argument('--stdin',
                       action='append_const',
                       dest='infiles',
                       const=sys.stdin,
                       help="use standard input",
                       )
    group.add_argument('-i', '--infile',
                       action='append',
                       dest='infiles',
                       help="any number of input files",
                       metavar="FILE",
                       )
    group.add_argument('-c', '--concatenate',
                       action='store_true',
                       dest='concatenate',
                       help="concatenate multiple input files into one output",
                       )

    group = parser.add_argument_group("Name-value pairs")
    group.add_argument('-a', '--arg',
                       action='append',
                       dest='args',
                       help="any number of name-value pairs",
                       metavar="NAME=VALUE",
                       )
    group.add_argument('-p', '--pyarg',
                       action='append',
                       dest='args',
                       type=_PyArg,
                       help="evaluate a python expression",
                       metavar="NAME=EXPRESSION",
                       )
    group.add_argument('-n', '--next',
                       action='append_const',
                       dest='args',
                       const='--',
                       help="begin next argument group",
                       )

    parser.add_argument(
                        dest='remainder',
                        nargs=argparse.REMAINDER,
                        help="possible input files and name-value pair groups "
                             "if not already specified through options",
                        )

    args = parser.parse_args(args)

    if args.engine == 'help':
        dump_engines()
        parser.exit(0)

    if args.engine not in engines.engines:
        parser.error("Engine '%s' is not available." % (args.engine,))

    if args.vary:
        if len(args.outfiles) != 1:
            parser.error("need exactly one output file template")
        if is_filelike(args.outfiles[0]):
            parser.error("vary requires an output file template")
    elif not args.outfiles:
        args.outfiles = [sys.stdout]

    if not args.infiles:
        if args.args:
            infiles = args.remainder
            args.remainder = []
            try:
                infiles.remove('--')
            except ValueError:
                pass
        else:
            first = 1 if args.remainder and args.remainder[0] == '--' else 0
            last = (len(args.remainder)
                    if args.vary or args.concatenate
                    else first + 1)
            for split, infile in enumerate(args.remainder[first:last], first):
                if infile == '--' or '=' in infile:
                    break
            else:
                split = last

            infiles = args.remainder[first:split]
            args.remainder = args.remainder[split:]

        args.infiles = [path if path != '-' else sys.stdin
                        for path in infiles] if infiles else [sys.stdin]

    if args.args:
        flat_args = args.args
    else:
        flat_args = args.remainder
        args.remainder = []
        if flat_args and flat_args[0] == '--':
            flat_args = flat_args[1:]

    args.args = []
    mapping = {}
    for arg in flat_args:
        if isinstance(arg, _PyArg):
            name_value = arg.split('=', 1)
            mapping[name_value[0]] = eval(name_value[1], {}, mapping)
        elif arg == '--':
            args.args.append(mapping)
            mapping = {}
        else:
            name_value = arg.split('=', 1)
            mapping[name_value[0]] = (name_value[1]
                                      if len(name_value) > 1
                                      else None)
    args.args.append(mapping)

    if args.remainder:
        parser.error("extraneous arguments left over")
    else:
        del args.remainder

    return args
197205
def parse_config_args(args)
      result = {}
      args.scan(/--?([a-z\-\_]+)\s([\d]+)\s?/).each do |arg|
        result[arg.first] = arg.last
      end
      {'raw' => args, 'parsed' => result}
    end
302068
def parse_args(cls):
        
        # Initialize configuration and userdata directories.
        dirs = appdirs.AppDirs(__title__, 'Mozilla Security')
        if not os.path.isdir(dirs.user_config_dir):
            shutil.copytree(os.path.join(cls.HOME, 'examples'), dirs.user_config_dir)
            shutil.copytree(os.path.join(cls.HOME, 'userdata'), os.path.join(dirs.user_config_dir, 'userdata'))

        parser = argparse.ArgumentParser(
            description='Laniakea Runtime v{}'.format(cls.VERSION),
            prog=__title__,
            add_help=False,
            formatter_class=lambda prog: argparse.ArgumentDefaultsHelpFormatter(prog, max_help_position=40, width=120),
            epilog='The exit status is 0 for non-failures and 1 for failures.')

        subparsers = parser.add_subparsers(dest='provider',
                                           description='Use -h to see the help menu of each provider.',
                                           title='Laniakea Cloud Providers',
                                           metavar='')

        modules = ModuleLoader()
        modules.load(cls.HOME, 'core/providers', 'laniakea')

        for name, module in modules.modules.items():
            globals()[name] = module

        for module, cli in modules.command_line_interfaces():
            getattr(module, cli).add_arguments(subparsers, dirs)

        base = parser.add_argument_group('Laniakea Base Parameters')
        base.add_argument('-verbosity',
                          default=2,
                          type=int,
                          choices=list(range(1, 6, 1)),
                          help='Log sensitivity.')

        base.add_argument('-focus',
                          action='store_true',
                          default=True,
                          help=argparse.SUPPRESS)

        base.add_argument('-settings',
                          metavar='path',
                          type=argparse.FileType(),
                          default=os.path.join(dirs.user_config_dir, 'laniakea.json'),
                          help='Laniakea core settings.')

        base.add_argument('-h', '-help', '--help',
                          action='help',
                          help=argparse.SUPPRESS)

        base.add_argument('-version',
                          action='version',
                          version='%(prog)s {}'.format(cls.VERSION),
                          help=argparse.SUPPRESS)

        userdata = parser.add_argument_group('UserData Parameters')
        userdata.add_argument('-userdata',
                              metavar='path',
                              type=argparse.FileType(),
                              help='UserData script for the provisioning process.')

        userdata.add_argument('-list-userdata-macros',
                              action='store_true',
                              help='List available macros.')

        userdata.add_argument('-print-userdata',
                              action='store_true',
                              help='Print the UserData script to stdout.')

        userdata.add_argument('-userdata-macros',
                              metavar='k=v',
                              nargs='+',
                              type=str,
                              help='Custom macros for the UserData.')

        return parser.parse_args()
332430
def get_args_pairs(arguments):
    

    return ' '.join(' '.join(['-' + k, tcl_str(str(v))]) for k, v in arguments.items())
159567
def parse_command_line():
    """"""
    parser = argparse.ArgumentParser(
        prog='csp_pulsar_sender',
        description='Send fake pulsar data using ftp protocol.')
    parser.add_argument('config_file', type=argparse.FileType('r'),
                        help='JSON configuration file.')
    parser.add_argument('-v', '--verbose', help='Enable verbose messages.',
                        action='store_true')
    parser.add_argument('-p', '--print_settings', help='Print settings file.',
                        action='store_true')
    return parser.parse_args()
615912
def parse_conf_args(argv):
    """"""

    args = {}
    for rarg in argv:
        if re.match("^--.*", rarg):
            arg = rarg.replace('--','', 1)

            fsplit = arg.split('=', 1)
            if len(fsplit) != 2:
                raise Exception(
                    "Command option '%s' not recognized." % rarg)

            rkey, value = fsplit
            ssplit = rkey.split('.', 1)
            if len(ssplit) != 2 or not ssplit[1]:
                raise Exception(
                    "Command option '%s' not recognized." % rarg)

            section, option = ssplit
            args[section] = (option, value)
        else:
            raise Exception(
                    "Command option '%s' not recognized." % rarg)

    return args
507159
def get_command_line_arguments():
    

    parser = argparse.ArgumentParser(add_help=False)

    parser.add_argument("-h",
                        "--help",
                        action="help",
                        help="'Displays this help message and exit.'")

    parser.add_argument("-t",
                        "--title",
                        type=unicode,
                        dest="title",
                        help="'Package title.'")

    parser.add_argument("-i",
                        "--input",
                        type=unicode,
                        dest="input",
                        help="'Input file to convert.'")

    parser.add_argument("-o",
                        "--output",
                        type=unicode,
                        dest="output",
                        help="'Output file.'")

    parser.add_argument("-c",
                        "--content_directory",
                        type=unicode,
                        dest="content_directory",
                        help="'Content directory.'")

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)

    return parser.parse_args()
1047173
def parse_args():
    '''  '''

    parser = argparse.ArgumentParser(prog='setup_tree_modules', usage='%(prog)s [opts]')
    parser.add_argument('-v', '--verbose', action='store_true', dest='verbose',
                        help='Print extra information.', default=False)
    parser.add_argument('-r', '--root', action='store', dest='root', default=os.getenv('SAS_BASE_DIR'),
                        help='Override the value of $SAS_BASE_DIR.', metavar='SAS_BASE_DIR')
    parser.add_argument('-t', '--treedir', action='store', dest='treedir', default=os.getenv('TREE_DIR'),
                        help='Override the value of $TREE_DIR.', metavar='TREE_DIR')
    parser.add_argument('-m', '--modulesdir', action='store', dest='modulesdir', default=os.getenv('MODULES_DIR'),
                        help='Your modules directory', metavar='MODULES_DIR')
    parser.add_argument('-e', '--env', action='store_true', dest='env',
                        help='Create tree environment symlinks.', default=False)
    parser.add_argument('-i', '--mirror', action='store_true', dest='mirror',
                        help='Use the mirror site (SAM) instead.')
    parser.add_argument('-o', '--only', action='store', dest='only', metavar='[xxx].cfg',
                        default=None, help='create links for only the specified tree config.')

    opts = parser.parse_args()

    return opts