Runs this {@see DayEnumExample}.

@param integer  $argc The number of arguments.
@param string[] $argv The arguments.

@return integer Always `0`.
354
public static function main($argc, array $argv = [])
    {
        $firstDay = new self(DayEnum::MONDAY());
        $firstDay->tellItLikeItIs();
        $thirdDay = new self(DayEnum::WEDNESDAY());
        $thirdDay->tellItLikeItIs();
        $fifthDay = new self(DayEnum::FRIDAY());
        $fifthDay->tellItLikeItIs();
        $sixthDay = new self(DayEnum::SATURDAY());
        $sixthDay->tellItLikeItIs();
        $seventhDay = new self(DayEnum::SUNDAY());
        $seventhDay->tellItLikeItIs();

        return 0;
    }
777432
function argv(k) {
		if (!nargv) {
			nargv = process.argv.slice(0, 2);
		}
		var v = '', m = null;
		var x = new RegExp(k + regexKeyVal.source);
		nargv.every(function(e) {
			m = e.match(x);
			if (m && m.length) {
				v = m[0];
				return false;
			}
		});
		return v;
	}
1036457
@Override
  public int run(String[] args) {
    int rv = -1;

    try {
      rv = run2(args);
    }
    catch (org.apache.hadoop.mapred.FileAlreadyExistsException e) {
      if (ctrlc != null) { ctrlc.setComplete(); }
      System.out.println("ERROR: " + (e.getMessage() != null ? e.getMessage() : "(null)"));
      System.exit(1);
    }
    catch (Exception e) {
      System.out.println("ERROR: " + (e.getMessage() != null ? e.getMessage() : "(null)"));
      e.printStackTrace();
      System.exit(1);
    }

    return rv;
  }
997956
public static void main(String argv[]) {
    StringUtils.startupShutdownMessage(HourGlass.class, argv, LOG);
    try {
      HourGlass hourGlass = new HourGlass(new Configuration());
      hourGlass.run();
    } catch (Throwable e) {
      LOG.fatal(StringUtils.stringifyException(e));
      System.exit(-1);
    }
  }
339638
def run(self, argv):
        
        try:
            index = 0
            command_pos = -1
            help_pos = -1
            help_command_pos = -1
            for arg in argv:
                if arg == 'bash-completion' and help_command_pos == -1:
                    self._bash_completion()
                    return 0
                if arg in self.commands[self.api_version]:
                    if command_pos == -1:
                        command_pos = index
                elif arg in ('-h', '--help'):
                    if help_pos == -1:
                        help_pos = index
                elif arg == 'help':
                    if help_command_pos == -1:
                        help_command_pos = index
                index = index + 1
            if command_pos > -1 and help_pos > command_pos:
                argv = ['help', argv[command_pos]]
            if help_command_pos > -1 and command_pos == -1:
                argv[help_command_pos] = '--help'
            self.options, remainder = self.parser.parse_known_args(argv)
            self.configure_logging()
            self.interactive_mode = not remainder
            self.initialize_app(remainder)
        except Exception as err:
            if self.options.verbose_level >= self.DEBUG_LEVEL:
                self.log.exception(err)
                raise
            else:
                self.log.error(err)
            return 1
        if self.interactive_mode:
            _argv = [sys.argv[0]]
            sys.argv = _argv
            return self.interact()
        return self.run_subcommand(remainder)
1325453
public static function argv(string $variable, $default = null) {
		return isset(self::$_argv[$variable])
			? self::$_argv[$variable]
			: $default;
	}
381730
public function runWithTry(array $argv)
    {
        try {
            return $this->run($argv);
        } catch (CommandArgumentNotEnoughException $e) {
            $this->logger->error($e->getMessage());
            $this->logger->writeln('Expected argument prototypes:');
            foreach ($e->getCommand()->getAllCommandPrototype() as $p) {
                $this->logger->writeln("\t" . $p);
            }
            $this->logger->newline();
        } catch (CommandNotFoundException $e) {
            $this->logger->error($e->getMessage() . ' available commands are: ' .
                implode(', ', $e->getCommand()->getVisibleCommandList())
            );
            $this->logger->newline();

            $this->logger->writeln('Please try the command below to see the details:');
            $this->logger->newline();
            $this->logger->writeln("\t" . $this->getProgramName() . ' help ');
            $this->logger->newline();
        } catch (BadMethodCallException $e) {
            $this->logger->error($e->getMessage());
            $this->logger->error('Seems like an application logic error, please contact the developer.');
        } catch (Exception $e) {
            ExceptionPrinter::dump($e, $this->getOption('debug'));
        }

        return false;
    }
1192562
public function handleRename(Args $args)
    {
        $moduleName = $args->getArgument('name');
        $newName = $args->getArgument('new-name');

        $this->moduleManager->renameModule($moduleName, $newName);

        return 0;
    }
1174950
public static void main(String[] argv) {
    if (argv.length == 0) {
      printUsage("");
      System.exit(-1);
    }

    String inputPathsString = null;
    Path outputPath = null;
    String shardsString = null;
    String indexPath = null;
    int numShards = -1;
    int numMapTasks = -1;
    Configuration conf = new Configuration();
    String confPath = null;

    // parse the command line
    for (int i = 0; i < argv.length; i++) { // parse command line
      if (argv[i].equals("-inputPaths")) {
        inputPathsString = argv[++i];
      } else if (argv[i].equals("-outputPath")) {
        outputPath = new Path(argv[++i]);
      } else if (argv[i].equals("-shards")) {
        shardsString = argv[++i];
      } else if (argv[i].equals("-indexPath")) {
        indexPath = argv[++i];
      } else if (argv[i].equals("-numShards")) {
        numShards = Integer.parseInt(argv[++i]);
      } else if (argv[i].equals("-numMapTasks")) {
        numMapTasks = Integer.parseInt(argv[++i]);
      } else if (argv[i].equals("-conf")) {
        // add as a local FS resource
        confPath = argv[++i];
        conf.addResource(new Path(confPath));
      } else {
        System.out.println("Unknown option " + argv[i] + " w/ value "
            + argv[++i]);
      }
    }
    LOG.info("inputPaths = " + inputPathsString);
    LOG.info("outputPath = " + outputPath);
    LOG.info("shards     = " + shardsString);
    LOG.info("indexPath  = " + indexPath);
    LOG.info("numShards  = " + numShards);
    LOG.info("numMapTasks= " + numMapTasks);
    LOG.info("confPath   = " + confPath);

    Path[] inputPaths = null;
    Shard[] shards = null;

    JobConf jobConf = new JobConf(conf);
    IndexUpdateConfiguration iconf = new IndexUpdateConfiguration(jobConf);

    if (inputPathsString != null) {
      jobConf.set("mapred.input.dir", inputPathsString);
    }
    inputPaths = FileInputFormat.getInputPaths(jobConf);
    if (inputPaths.length == 0) {
      inputPaths = null;
    }

    if (outputPath == null) {
      outputPath = FileOutputFormat.getOutputPath(jobConf);
    }

    if (inputPaths == null || outputPath == null) {
      System.err.println("InputPaths and outputPath must be specified.");
      printUsage("");
      System.exit(-1);
    }

    if (shardsString != null) {
      iconf.setIndexShards(shardsString);
    }
    shards = Shard.getIndexShards(iconf);
    if (shards != null && shards.length == 0) {
      shards = null;
    }

    if (indexPath == null) {
      indexPath = getIndexPath(conf);
    }
    if (numShards <= 0) {
      numShards = getNumShards(conf);
    }

    if (shards == null && indexPath == null) {
      System.err.println("Either shards or indexPath must be specified.");
      printUsage("");
      System.exit(-1);
    }

    if (numMapTasks <= 0) {
      numMapTasks = jobConf.getNumMapTasks();
    }

    try {
      // create shards and set their directories if necessary
      if (shards == null) {
        shards = createShards(indexPath, numShards, conf);
      }

      long startTime = now();
      try {
        IIndexUpdater updater =
            (IIndexUpdater) ReflectionUtils.newInstance(
                iconf.getIndexUpdaterClass(), conf);
        LOG.info("sea.index.updater = "
            + iconf.getIndexUpdaterClass().getName());

        updater.run(conf, inputPaths, outputPath, numMapTasks, shards);
        LOG.info("Index update job is done");

      } finally {
        long elapsedTime = now() - startTime;
        LOG.info("Elapsed time is  " + (elapsedTime / 1000) + "s");
        System.out.println("Elapsed time is " + (elapsedTime / 1000) + "s");
      }
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }
39300
public function parseParams($argv)
    {
        if (is_string($argv)) {
            $argv = gplcart_string_explode_whitespace($argv);
        }

        array_shift($argv);

        $out = array();
        for ($i = 0, $j = count($argv); $i < $j; $i++) {

            $key = null;
            $arg = $argv[$i];

            if (substr($arg, 0, 2) === '--') {

                $pos = strpos($arg, '=');

                if ($pos === false) {
                    $key = substr($arg, 2);
                    if ($i + 1 < $j && $argv[$i + 1][0] !== '-') {
                        $value = $argv[$i + 1];
                        $i++;
                    } else {
                        $value = isset($out[$key]) ? $out[$key] : true;
                    }

                    $out[$key] = $value;
                    continue;
                }

                $key = substr($arg, 2, $pos - 2);
                $value = substr($arg, $pos + 1);
                $out[$key] = $value;
                continue;
            }

            if (substr($arg, 0, 1) === '-') {

                if (substr($arg, 2, 1) === '=') {
                    $key = substr($arg, 1, 1);
                    $value = substr($arg, 3);
                    $out[$key] = $value;
                    continue;
                }

                foreach (str_split(substr($arg, 1)) as $char) {
                    $key = $char;
                    $value = isset($out[$key]) ? $out[$key] : true;
                    $out[$key] = $value;
                }

                if ($i + 1 < $j && $argv[$i + 1][0] !== '-') {
                    $out[$key] = $argv[$i + 1];
                    $i++;
                }

                continue;
            }

            $value = $arg;
            $out[] = $value;
        }

        return $out;
    }
327644
public function executeAll(...$args)
    {
        if ($this->isEmpty()) {
            return 0;
        }
        $n = 0;
        do {
            $cb = $this->extract();
            if ($cb) {
                $cb(...$args);
                ++$n;
            }
        } while (!$this->isEmpty());
        return $n;
    }
512186
public function getOptsValues($argv=null) {
    $parsed_args = ArgumentsParser::parseArgvWithSpec($this->resolveArgv($argv), $this->arguments_spec);
    return new ArgumentValues($this->arguments_spec, $parsed_args);
  }
1062687
public function parse(array $argv): Command
    {
        $this->argv = $argv;

        $command = $this->commandFor($argv);
        $aliases = $this->aliasesFor($command);

        // Eat the cmd name!
        foreach ($argv as $i => $arg) {
            if (\in_array($arg, $aliases)) {
                unset($argv[$i]);

                break;
            }

            if ($arg[0] === '-') {
                break;
            }
        }

        return $command->parse($argv);
    }
916504
public function check(...$args)
    {
        if (count($args) !== count($this->constraints)) {
            throw new InvalidArgumentException(
                'Argument number mismatch.'
            );
        }

        foreach ($args as $key => $arg) {
            if (!$this->constraints[$key]->check($arg, $args)) {
                throw new InvalidArgumentException(vsprintf(
                    'Argument %s does not meet its constraints.'
                    . "\nFailed constraint: %s\nValue provided:%s",
                    [
                        $key,
                        $this->constraints[$key]->toString(),
                        print_r($arg, true)
                    ]
                ));
            }
        }
    }
760432
public function run($args)
	{
		$runner=$this->getCommandRunner();
		$commands=$runner->commands;
		if(isset($args[0]))
			$name=strtolower($args[0]);
		if(!isset($args[0]) || !isset($commands[$name]))
		{
			echo <<<EOD
At the prompt, you may enter a PHP statement or one of the following commands:

EOD;
			$commandNames=array_keys($commands);
			sort($commandNames);
			echo ' - '.implode("\n - ",$commandNames);
			echo <<<EOD


Type 'help <command-name>' for details about a command.

To expand the above command list, place your command class files
under 'protected/commands/shell', or a directory specified
by the 'YIIC_SHELL_COMMAND_PATH' environment variable. The command class
must extend from CConsoleCommand.

EOD;
		}
		else
			echo $runner->createCommand($name)->getHelp();
		return 1;
	}
228667
public function count(...$arguments): ?int
    {
        $where       = $arguments[0] ?? null;
        $whereParams = $arguments[1] ?? null;

        $query = $this->initQueryBuilder();
        try {
            $query->select('1');

            if ($where != null) {
                $query->where($where, $whereParams);
            }

            return $query->count();
        } catch (\Exception $e) {
            $this->setFail($e);

            return null;
        }
    }
438200
public static void main(String[] argv) {
		try {
			// create a new container for our example game. This container
			// just creates a normal native window for rendering OpenGL accelerated
			// elements to
			AppGameContainer container = new AppGameContainer(new Scroller(), 800, 600, false);
			container.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}