SampleTask command

@param array $args
@return void
507044
public function command($args)
    {
        // Access items in container
        $settings = $this->container->get('settings');
        
        // Throw if no arguments provided
        if (empty($args)) {
            throw new RuntimeException("No arguments passed to command");
        }

        $firstArg = $args[0];

        // Output the first argument
        return $firstArg;
    }
358604
public function main(array $args = array()) {
        Garp_Cli::errorOut('This command is no longer compatible with the AWS Cli tool and should be refactored.');
        return false;
        if (!$this->_usesAmazon()) {
            Garp_Cli::errorOut(
                'Clearly this environment does not ' .
                'use Amazon services. Get outta here!'
            );
            return false;
        }

        $this->_setProfile();

        if (!$this->_profileExists()) {
            $this->_createProfile();
        }
        return parent::main($args);
    }
462636
public function execute(array $args, array $options = [])
    {
        $template = isset($options['template']) ? $options['template'] : false;
        $template || $template = __DIR__ . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'Controller.php.dist';

        $name = $args[0];
        $name = explode('-', $name);
        if (count($name) < 1) {
            throw new \InvalidArgumentException(sprintf(
                'The arg name "%s" is invalid. eg: adminbase-Blog/Category',
                $name
            ));
        }
        $namespace = str_replace('/', '\\', trim(trim($name[0], '\\/')));

        $path = Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $namespace . DIRECTORY_SEPARATOR
            . Cml::getApplicationDir('app_controller_path_name') . DIRECTORY_SEPARATOR;
        $component = explode('/', trim(trim($name[1], '/')));

        if (count($component) > 1) {
            $className = ucfirst(array_pop($component)) . Config::get('controller_suffix');
            $component = implode(DIRECTORY_SEPARATOR, $component);
            $path .= $component . DIRECTORY_SEPARATOR;
            $component = '\\' . $component;
        } else {
            $className = ucfirst($component[0]) . Config::get('controller_suffix');
            $component = '';
        }

        if (!is_dir($path) && false == mkdir($path, 0700, true)) {
            throw new \RuntimeException(sprintf(
                'The path "%s" could not be create',
                $path
            ));
        }

        $contents = strtr(file_get_contents($template), ['$namespace' => $namespace, '$component' => $component, '$className' => $className]);

        $file = $path . $className . '.php';
        if (is_file($file)) {
            throw new \RuntimeException(sprintf(
                'The file "%s" is exist',
                $file
            ));
        }

        if (false === file_put_contents($file, $contents)) {
            throw new \RuntimeException(sprintf(
                'The file "%s" could not be written to',
                $path
            ));
        }

        Output::writeln(Colour::colour('Controller created successfully. ', Colour::GREEN));
    }
418807
public function make(array $args = array()) {
        $userModel = new Model_User();
        if (!empty($args)) {
            $id = $args[0];
        } else {
            $id = Garp_Cli::prompt('What is the id or email address of the user?');
        }
        $select = $userModel->select();
        if (is_numeric($id)) {
            $filterColumn = 'id';
        } else {
            $filterColumn = 'email';
        }
        $select->where($filterColumn . ' = ?', $id);
        $user = $userModel->fetchRow($select);
        if (!$user) {
            Garp_Cli::errorOut('Error: could not find user with ' . $filterColumn . ' ' . $id);
        } else {
            $user->role = 'admin';
            if ($user->save()) {
                // For completeness sake, check if the user has an AuthLocal
                // record. We disregard the fact wether the user already has any
                // of the other Auth- records.
                $authLocalModel = new Model_AuthLocal();
                $authLocalRecord = $authLocalModel->fetchRow(
                    $authLocalModel->select()->where('user_id = ?', $user->id)
                );
                if (!$authLocalRecord) {
                    $newAuthLocalData = array(
                        'password' => trim(Garp_Cli::prompt('Choose a password:')),
                        'user_id'  => $user->id
                    );
                    $authLocalModel->insert($newAuthLocalData);
                }
                Garp_Cli::lineOut(
                    'User with ' . $filterColumn . ' ' . $id .
                    ' is now administrator'
                );
            } else {
                Garp_Cli::errorOut(
                    'Error: could not make user with ' . $filterColumn . ' ' . $id .
                    ' administrator'
                );
            }
        }
    }
1215204
public static function route(string $command, array $args) : void {
        $object = new static('test');
        echo "\n";
        if (method_exists(static::class, $command)) {
            $response = call_user_func_array([$object, $command], $args);
            if ($response === NULL)
                echo "SUCCESS";
            else if ($response === FALSE)
                echo "FALSE";
            else if ($response === TRUE)
                echo "TRUE";
            else {
                if (is_string($response))
                    echo $response;
                else print_r($response);
            }
        } else echo "No such method available";
        echo "\n\n";
    }
471879
public function run(array $args)
    {
        $command = (string)$args[1];
        $this->router->match($command);
        $args = array_slice($args, 2);

        return $this->router->executeCommand($args);
    }
163317
public function start($args)
    {
        parent::start($args);
        if (!$this->_header) {
            return;
        }
        $this->write($this->kahlan() . "\n\n");
        $this->write($this->kahlanBaseline() . "\n\n", 'dark-grey');
        $this->write("src directory  : ", 'blue');
        $this->write(join(', ', array_map('realpath', $this->_srcDir)) . "\n");
        $this->write("spec directory : ", 'blue');
        $this->write(join(', ', array_map('realpath', $this->_specDir)) . "\n");
    }
890027
public function start($args)
    {
        $this->_header = false;
        parent::start($args);
        $this->write("\n1..{$args['total']}\n");
    }
191231
private function _parseArgs(array $args)
	{
		$arg = '';
		if(count($args) > 0)
		{
			foreach($args as $number => $argument)
			{
				if($number === 0)
				{
					$arg .= $argument;
				}
				else
				{
					$arg .= ', ' . $argument;
				}
			}
		}

		return $arg;
	}
305744
private function runInit($args)
    {
        $cmd = new InitCommand($this->cwd);

        return $cmd->run(array_slice($args, 1));
    }
1062997
public function set(array $args = array()) {
        if (!file_exists('application/data/cache')
            || !file_exists('application/data/logs')
            || !file_exists('public/uploads')
        ) {
            Garp_Cli::lineOut(
                'It looks like there are no directories for me to set permissions on.',
                Garp_Cli::YELLOW
            );
            return true;
        }
        Garp_Cli::lineOut('Setting permissions on writable folders...');
        passthru('chmod -R 777 application/data/cache');
        passthru('chmod -R 777 application/data/logs');
        passthru('chmod -R 777 public/uploads');

        Garp_Cli::lineOut('Done.');
        Garp_Cli::lineOut('');
        return true;
    }
1309126
public static function run ($args) {

		//Initialize colors
		Bartender::setup();

		//Start on a new line
		Bartender::printColored("\n", "white");

		//Show all commands
		if (count($args) == 1) {
			Bartender::printColored("Commands avaible:", "purple");
			Bartender::newLine();

			foreach (Bartender::$commands as $key => $value) {
				Bartender::printColored($key, "green");
				Bartender::newLine();
				$value = "Acai\Core\Commands\\".$value;
				$value::description();
				Bartender::newLine();
				Bartender::newLine();
			}
		}
		//Show command specific help
		else {
			//Gather
			$caller 	= array_shift($args);
			$command 	= array_shift($args);
			$action		= (count($args) > 0)? array_shift($args):"";

			if (isset(Bartender::$commands[$command])) {
				$command = "Acai\Core\Commands\\".Bartender::$commands[$command];
				$command::action($action);
				$command::arguments($args);
				$command::run();
			}
			else {
				Bartender::printColored("Command not found", "white", "red");
			}
		}
		Bartender::printColored("", "white", "black");
	}
1375024
public function start($args)
    {
        parent::start($args);
        $this->_dotWidth = max($this->_columns - 11 - strlen($this->_total) * 2, 10);
        $this->write("\n");
    }
309506
private function cmdCheck($args)
    {
        $cmd = new CheckCommand($this->cwd);

        return $cmd->run(array_slice($args, 1));
    }
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;
	}
1009574
private function _execute($args = array())
    {
        if ($this->_err) {
            return false;
        };
        if ($this->_sth) {
            if ($this->_sth->execute($args)) {
                return true;
            } else {
                $this->_err = implode(' ', $this->_sth->errorInfo());
                return false;
            };
        } else {
            $this->_err = "No statement to execute.";
        };
        return false;
    }
1296559
private function cmdMount($args)
    {
        $cmd = new MountCommand($this->cwd);

        return $cmd->run(array_slice($args, 1));
    }