Processes the options set by the command-line arguments,
 and runs the CSS compiler appropriately.
10713
def process_result
      require 'sass'

      if @options[:recursive]
        process_directory
        return
      end

      super
      input = @options[:input]
      if File.directory?(input)
        raise "Error: '#{input.path}' is a directory (did you mean to use --recursive?)"
      end
      output = @options[:output]
      output = input if @options[:in_place]
      process_file(input, output)
    end
729535
function run(argv, options, loader) {
  debug('argv', argv, 'options', options);

  if (options.help || options.h) {
    return loader.printUsage('env');
  }

  var selector = options._; // the argv, stripped of the flags (both -- and -)

  installPaths(function(er, paths) {
    var execPaths = resolvePaths(paths);

    execPaths['slc-npm'] = slcNpmPath(execPaths.slc);
    execPaths['node-npm'] = nodeNpmPath(execPaths.node);

    var env = {
      cwd: process.cwd(),
      paths: {
        link: paths,
        exec: execPaths
      },
      versions: process.versions,
      platform: process.platform,
      config: process.config,
      // redundant with .paths: execPath: process.execPath,
      features: process.features
    };
    try {
      env = selectProperties(selector, env);//XXX argv--> includes options?
    } catch (er) {
      return loader.error(er.message);
    }
    console.log(env);
  });
}
1139484
static void processArgs(String[] args, final PrintStream out) {
        Options options = buildOptions();

        try {
            CommandLine cmd = parseCommandLine(options, args);

            if (cmd.hasOption('h')) {
                printHelp(out, options);
            } else if (cmd.hasOption('v')) {
                String version = GroovySystem.getVersion();
                out.println("Groovy Version: " + version + " JVM: " + System.getProperty("java.version") + 
                        " Vendor: " + System.getProperty("java.vm.vendor")  + " OS: " + System.getProperty("os.name"));
            } else {
                // If we fail, then exit with an error so scripting frameworks can catch it
                // TODO: pass printstream(s) down through process
                if (!process(cmd)) {
                    System.exit(1);
                }
            }
        } catch (ParseException pe) {
            out.println("error: " + pe.getMessage());
            printHelp(out, options);
        } catch (IOException ioe) {
            out.println("error: " + ioe.getMessage());
        }
    }
942066
def run(self):
    
    self.parser = MultioptOptionParser(
      usage="%prog <command> [options] [args]",
      prog=self.clsname,
      version=self.version,
      option_list=self.global_options,
      description=self.desc_short,
      commands=self.command_set,
      epilog=self.footer
    )
    
    try:
      self.options, self.args = self.parser.parse_args(self.argv)    
    except Exception, e:
      print str(e)
      pass

    if len(self.args) < 1:
      self.parser.print_lax_help()
      return 2
    
    self.command = self.args.pop(0)
    showHelp = False
    
    if self.command == 'help': 
      if len(self.args) < 1:
        self.parser.print_lax_help()
        return 2
      else:
        self.command = self.args.pop()
        showHelp = True

    if self.command not in self.valid_commands:
      self.parser.print_cmd_error(self.command)
      return 2

    self.command_set[self.command].set_cmdname(self.command)
    subcmd_parser = self.command_set[self.command].get_parser(self.clsname, self.version, self.global_options)
    subcmd_options, subcmd_args = subcmd_parser.parse_args(self.args)

    if showHelp:
      subcmd_parser.print_help_long()
      return 1

    try:
      self.command_set[self.command].func(subcmd_options, *subcmd_args)
    except (CommandError, TypeError), e:
      # self.parser.print_exec_error(self.command, str(e))
      subcmd_parser.print_exec_error(self.command, str(e))
      print 
      # @TODO show command help
      # self.parser.print_lax_help()
      return 2

      
    return 1
603255
def main():
    """"""
    actions = []
    try:
        # Parse the command line arguments.
        options, arguments = getopt.getopt(sys.argv[1:], 'cdh', [
            'convert', 'to-html', 'demo', 'help',
        ])
        # Map command line options to actions.
        for option, value in options:
            if option in ('-c', '--convert', '--to-html'):
                actions.append(functools.partial(convert_command_output, *arguments))
                arguments = []
            elif option in ('-d', '--demo'):
                actions.append(demonstrate_colored_logging)
            elif option in ('-h', '--help'):
                usage(__doc__)
                return
            else:
                assert False, "Programming error: Unhandled option!"
        if not actions:
            usage(__doc__)
            return
    except Exception as e:
        warning("Error: %s", e)
        sys.exit(1)
    for function in actions:
        function()
1068267
def process_arguments(arguments):
    """"""
    Settings.update(arguments)

    Settings.config_program_reqs(PROGRAMS)

    Settings.verbose = arguments.verbose + 1
    Settings.paths = set(arguments.paths)

    if arguments.formats == DEFAULT_FORMATS:
        Settings.formats = arguments.to_png_formats | \
            jpeg.FORMATS | gif.FORMATS
    else:
        Settings.formats = set(
            arguments.formats.upper().split(FORMAT_DELIMETER))

    if arguments.comics:
        Settings.formats = Settings.formats | comic.FORMATS

    if arguments.optimize_after is not None:
        try:
            after_dt = dateutil.parser.parse(arguments.optimize_after)
            arguments.optimize_after = time.mktime(after_dt.timetuple())
        except Exception as ex:
            print(ex)
            print('Could not parse date to optimize after.')
            exit(1)

    if arguments.jobs < 1:
        Settings.jobs = 1

    # Make a rough guess about weather or not to invoke multithreding
    # jpegrescan '-t' uses three threads
    # one off multithread switch bcaseu this is the only one right now
    files_in_paths = 0
    non_file_in_paths = False
    for filename in arguments.paths:
        if os.path.isfile(filename):
            files_in_paths += 1
        else:
            non_file_in_paths = True
    Settings.jpegrescan_multithread = not non_file_in_paths and \
        Settings.jobs - (files_in_paths*3) > -1

    return arguments
1226149
def process_options(opts, config)
      options.each do |option|
        opts.on(*option.for_option_parser) do |x|
          config[map[option]] = x
        end
      end
    end
989366
public static void main(String[] args) {
    org.apache.commons.cli.Options cliOptions = createCliOptions();
    try {
      CommandLine cli = parseCli(args, cliOptions);
      Options options = loadOptions(cli);
      validate(options);
      ConstraintParser parser = new ConstraintParser(options);
      try {
        output(parser, options.getOutputFile());
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    } catch (IncompleteCliException e) {
      // If the command line is not complete just print usage and help
      printErrorWithUsageAndHelp(cliOptions);
    }
  }
335480
function runCommand(command, options) {
    let cmd = getCommand(command);
    if (!cmd || command === 'help') {
      cmd = getCommand('help');
    } else {
      try {
        validateConfig(options);
      } catch (error) {
        console.log(error.message);
        process.exit(1);
      }
    }
    let fn = cmd.callback;
    let opts = mapParams(cmd, options);
    fn(opts).then(function (result) {
      if (cmd.formatter) {
        cmd.formatter.format(result.messages, options);
      } else {
        console.log(result);
      }
    }).catch(function (error) {
      let formatter = new formatters.MessageFormatter();
      if (error.response) {
        console.log(error);
        formatter.format(['Error response received: ' + error.response.data.errors[0].message]);
      } else {

        formatter.format([error.message]);
      }
      process.exit(1);
    });
  }
474223
def run(args) #:nodoc:
      args = args.dup if @preserve_argv
      the_command = nil
      begin
        override_defaults_based_on_config(parse_config)

        add_help_switch_if_needed(self)

        gli_option_parser = GLIOptionParser.new(commands,
                                                flags,
                                                switches,
                                                accepts,
                                                :default_command => @default_command,
                                                :autocomplete => autocomplete,
                                                :subcommand_option_handling_strategy => subcommand_option_handling_strategy,
                                                :argument_handling_strategy => argument_handling_strategy)

        parsing_result = gli_option_parser.parse_options(args)
        parsing_result.convert_to_openstruct! if @use_openstruct

        the_command = parsing_result.command

        if proceed?(parsing_result)
          call_command(parsing_result) 
          0
        else
          raise PreconditionFailed, "preconditions failed"
        end
      rescue Exception => ex
        if the_command.nil? && ex.respond_to?(:command_in_context)
          the_command = ex.command_in_context
        end
        handle_exception(ex,the_command)
      end
    end
519054
def run(self, args):
        
        configuration = self.configuration
        source_messages_dir = configuration.source_messages_dir
        for locale, converter in zip(configuration.dummy_locales, [Dummy(), Dummy2(), ArabicDummy()]):
            print('Processing source language files into dummy strings, locale "{}"'.format(locale))
            for source_file in configuration.source_messages_dir.walkfiles('*.po'):
                if args.verbose:
                    print('   ', source_file.relpath())
                make_dummy(source_messages_dir.joinpath(source_file), locale, converter)
        if args.verbose:
            print()
808925
def main(argv=None):
    """"""
    parser = argparse.ArgumentParser(description="Process raw HTML to baked"
                                                 " (embedded numbering and"
                                                 " collation)")
    parser.add_argument('-v', '--version', action="version",
                        version=__version__, help='Report the library version')
    parser.add_argument("css_rules",
                        type=argparse.FileType('rb'),
                        help="CSS3 ruleset stylesheet recipe")
    parser.add_argument("html_in", nargs="?",
                        type=argparse.FileType('r'),
                        help="raw HTML file to bake (default stdin)",
                        default=sys.stdin)
    parser.add_argument("html_out", nargs="?",
                        type=argparse.FileType('w'),
                        help="baked HTML file output (default stdout)",
                        default=sys.stdout)
    parser.add_argument('-s', '--stop-at', action='store', metavar='<pass>',
                        help='Stop baking just before given pass name')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Send debugging info to stderr')
    parser.add_argument('-q', '--quiet', action='store_true',
                        help="Quiet all on stderr except errors")
    parser.add_argument('-c', '--coverage-file', metavar='coverage.lcov',
                        type=FileTypeExt('w'),
                        help="output coverage file (lcov format). If "
                        "filename starts with '+', append coverage info.")
    parser.add_argument('--use-repeatable-ids', action='store_true',
                        help="use repeatable id attributes instead of uuids "
                        "which is useful for diffing")
    args = parser.parse_args(argv)

    formatter = logging.Formatter('%(name)s %(levelname)s %(message)s')
    handler = logging.StreamHandler(sys.stderr)
    handler.setFormatter(formatter)
    logger.addHandler(handler)

    use_quiet_log = (args.quiet and logging.ERROR)
    use_debug_log = (args.debug and logging.DEBUG)

    # Debug option takes higher priority than quiet warnings option
    logger.setLevel(use_debug_log or use_quiet_log or logging.WARNING)

    try:
        easybake(args.css_rules, args.html_in, args.html_out, args.stop_at,
                 args.coverage_file, args.use_repeatable_ids)
    finally:
        if args.css_rules:
            args.css_rules.close()
        if args.html_in:
            args.html_in.close()
        if args.html_out:
            args.html_out.close()
        if args.coverage_file:
            args.coverage_file.close()
1291227
def run(args)
      options = SCSSLint::Options.new.parse(args)
      act_on_options(options)
    rescue StandardError => e
      handle_runtime_exception(e, options)
    end
725936
def build_css(minimize=True):
  
  print('Build CSS')
  args = {}
  args['style'] = 'compressed' if minimize else 'nested'
  cmd = CMD_SASS.format(**args)
  run(cmd)
461279
def main():
    """"""
    from optparse import OptionParser

    parser = OptionParser(usage="%prog [options]")
    parser.add_option(
        "--werkzeug-path",
        "-p",
        dest="path",
        default="..",
        help="the path to the werkzeug package. defaults to cwd",
    )
    parser.add_option(
        "--compare",
        "-c",
        dest="compare",
        nargs=2,
        default=False,
        help="compare two hg nodes of Werkzeug",
    )
    parser.add_option(
        "--init-compare",
        dest="init_compare",
        action="store_true",
        default=False,
        help="Initializes the comparison feature",
    )
    options, args = parser.parse_args()
    if args:
        parser.error("Script takes no arguments")
    if options.compare:
        compare(*options.compare)
    elif options.init_compare:
        init_compare()
    else:
        run(options.path)
651515
def parse_options(args) # :nodoc:
      option_parser_class = self.class.const_get("#{options[:subcommand_option_handling_strategy].to_s.capitalize}CommandOptionParser")
      OptionParsingResult.new.tap { |parsing_result|
        parsing_result.arguments = args
        parsing_result = @global_option_parser.parse!(parsing_result)
        option_parser_class.new(@accepts).parse!(parsing_result, options[:argument_handling_strategy])
      }
    end
843993
def handle(self):
        
        self.output = PyStratumStyle(self.input, self.output)

        config_file = self.argument('config_file')
        sources = self.argument('file_names')

        status = self.run_command(config_file, sources)

        return status