Execute Nestor CLI.
552681
function exec() {

  var actions = {
    commands: {
      'delete': { action: _delete },
      screenshot: { action: _screenshot }
    }
  };

  bag.command(__dirname, actions);
}
470604
public function handle()
    {
        $options = $this->options();
        foreach (['host', 'port', 'username', 'secret'] as $key) {
            $value = Arr::get($options, $key, null);
            $value = is_null($value) ? Arr::get($this->config, $key, null) : $value;
            $options[$key] = $value;
        }
        $client = $this->connector->create($options);
        $client->then([$this, 'client'], [$this, 'writeException']);
        $this->loop->run();
    }
592064
function exec() {

  var actions = {
    commands: {
      init: { action: _init },
      run : { action: _run }
    }
  };

  cli.command(__dirname, actions);
}
1230483
public function handle()
    {
        $this->abortCommandExecution();
        $this->info('Installing a deployment script with hooks...');
        $data = [
            "ACACHA_FORGE_DOMAIN" => $this->domain,
            "PHP_VERSION_FPM" => 'php7.1-fpm',
        ];
        $content = $this->compiler->compile(
            file_get_contents($this->getStubPath()),
            $data);
        $tmp_file = tempnam(sys_get_temp_dir(), 'deploy_script_with_hooks');
        file_put_contents($tmp_file, $content);
        $this->call('publish:deployment_script', [
            'file' => $tmp_file
        ]);
    }
1274894
public function handle()
    {
        $this->abortCommandExecution();
        $file = $this->argument('file');
        $this->runScp(base_path($file), $this->domain, null, true);
    }
1054930
def _execute_command(self, command, *args):
        """"""
        try:
            command(*args)
        except libvirt.libvirtError as error:
            raise RuntimeError("Unable to execute command. %s" % error)
737945
public function handle()
    {

        // Ask what command
        $command = $this->choice('What command are you running?', $this->availableCommands->toArray());

        if (!$this->availableCommands->has($command)) {
            $this->info('The specified command does not exist.');
            return;
        }

        $method = 'make' . ucfirst($command);
        call_user_func([$this, $method]);

        $this->call('make:'. $command, $this->options);
    }
420916
public function execute()
    {
        if (PSI_OS == 'WINNT') {
            try {
                $objLocator = new COM('WbemScripting.SWbemLocator');
                $wmi = $objLocator->ConnectServer('', 'root\StableBit\Scanner');
                $this->_result = CommonFunctions::getWMI($wmi, 'Disks', $this->stablebit_items);
            } catch (Exception $e) {
            }
        }
    }
1012044
public function dispatch()
    {
        if (php_sapi_name() === 'cli' || defined('STDIN')) {

            global $argv;

            App::resolve('Cli', [array_slice($argv, 1), $this]);

            exit();
        }

        $this->execute()->respond()->terminate();
    }
294107
def exec_(controller, cmd, *args):
    """"""
    controller.logger.info("Executing: {0} {1}", cmd, " ".join(args))

    try:
        subprocess.check_call([cmd] + list(args))
    except (OSError, subprocess.CalledProcessError) as err:
        controller.logger.error("Failed to execute process: {0}", err)
339130
public function execute()
    {
        parent::execute();

        if (empty($this->optionFilename)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_FILENAME'))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        if (strpos($this->optionPath, 'Commanders') === false) {
            $filePath = $this->optionPath . 'Commanders' . DIRECTORY_SEPARATOR . $this->optionFilename;
        } else {
            $filePath = $this->optionPath . $this->optionFilename;
        }

        $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR;

        if ( ! is_dir($fileDirectory)) {
            mkdir($fileDirectory, 0777, true);
        }

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_EXISTS', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        $className = prepare_class_name(pathinfo($filePath, PATHINFO_FILENAME));
        @list($namespaceDirectory, $subNamespace) = explode('Commanders', dirname($filePath));

        $classNamespace = loader()->getDirNamespace(
                $namespaceDirectory
            ) . 'Commanders' . (empty($subNamespace)
                ? null
                : str_replace(
                    '/',
                    '\\',
                    $subNamespace
                )) . '\\';

        $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m');
        $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\');
        $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\');
        $vars[ 'CLASS' ] = $className;
        $vars[ 'FILEPATH' ] = $filePath;

        $phpTemplate = <<<PHPTEMPLATE
<?php
/**
 * Created by O2System Framework File Generator.
 * DateTime: CREATE_DATETIME
 */

// ------------------------------------------------------------------------

namespace NAMESPACE;

// ------------------------------------------------------------------------

use O2System\Framework\Http\Commander;

/**
 * Class CLASS
 *
 * @package PACKAGE
 */
class CLASS extends Commander
{
    /**
     * CLASS::index
     */
    public function index()
    {
        // TODO: Change the autogenerated stub
    }
}
PHPTEMPLATE;

        $fileContent = str_replace(array_keys($vars), array_values($vars), $phpTemplate);
        file_put_contents($filePath, $fileContent);

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::SUCCESS)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_S_MAKE', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_SUCCESS);
        }
    }
761837
def handle_exec(args):
    
    session_file = get_db_name(args.get('<session-file>'))
    cosmic_ray.commands.execute(session_file)

    return ExitCode.OK
488771
def execute(self, env):
        

        # parse args
        parser = self._get_parser(env)
        parsed_args, cmd_args = parser.parse_known_args(env.args)

        # disable colors
        if parsed_args.no_color:
            env.io.set_colored(False)

        # run command handler passing any remaining args
        if not parsed_args.func(env, cmd_args):
            raise HelpBanner(parser.format_help())
136842
def _execute_command(cmd, at_time=None):
    '''
    
    '''
    if at_time:
        cmd = 'echo \'{0}\' | at {1}'.format(cmd, _cmd_quote(at_time))
    return not bool(__salt__['cmd.retcode'](cmd, python_shell=True))
1008835
public function handle()
    {
        if (is_null($this->argument('name'))) {
            $this->installFromFile();

            return;
        }

        $this->install(
            $this->argument('name'),
            $this->argument('version'),
            $this->option('type'),
            $this->option('tree')
        );
    }
628759
public function handle()
    {

        if (! $this->preflighted()) return;

        $killmails = CharacterKillmail::where('character_id', $this->getCharacterId())
            ->whereNotIn('killmail_id', function ($query) {

                $query->select('killmail_id')
                    ->from('killmail_details');

            })->pluck('killmail_id', 'killmail_hash');

        $killmails->each(function ($killmail_id, $killmail_hash) {

            $detail = $this->retrieve([
                'killmail_id'   => $killmail_id,
                'killmail_hash' => $killmail_hash,
            ]);

            if ($detail->isCachedLoad()) return;

            KillmailDetail::firstOrCreate([
                'killmail_id'     => $killmail_id,
            ], [
                'killmail_time'   => carbon($detail->killmail_time),
                'solar_system_id' => $detail->solar_system_id,
                'moon_id'         => property_exists($detail, 'moon_id') ? $detail->moon_id : null,
                'war_id'          => property_exists($detail, 'war_id') ? $detail->war_id : null,
            ]);

            KillmailVictim::firstOrCreate([
                'killmail_id'    => $killmail_id,
            ], [
                'character_id'   => property_exists($detail->victim, 'character_id') ?
                    $detail->victim->character_id : null,
                'corporation_id' => property_exists($detail->victim, 'corporation_id') ?
                    $detail->victim->corporation_id : null,
                'alliance_id'    => property_exists($detail->victim, 'alliance_id') ?
                    $detail->victim->alliance_id : null,
                'faction_id'     => property_exists($detail->victim, 'faction_id') ?
                    $detail->victim->faction_id : null,
                'damage_taken'   => $detail->victim->damage_taken,
                'ship_type_id'   => $detail->victim->ship_type_id,
                'x'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->x : null,
                'y'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->y : null,
                'z'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->z : null,
            ]);

            collect($detail->attackers)->each(function ($attacker) use ($killmail_id) {

                KillmailAttacker::firstOrCreate([
                    'killmail_id'     => $killmail_id,
                    'character_id'    => property_exists($attacker, 'character_id') ?
                        $attacker->character_id : null,
                    'corporation_id'  => property_exists($attacker, 'corporation_id') ?
                        $attacker->corporation_id : null,
                    'alliance_id'     => property_exists($attacker, 'alliance_id') ?
                        $attacker->alliance_id : null,
                    'faction_id'      => property_exists($attacker, 'faction_id') ?
                        $attacker->faction_id : null,
                    'security_status' => $attacker->security_status,
                    'final_blow'      => $attacker->final_blow,
                    'damage_done'     => $attacker->damage_done,
                    'ship_type_id'    => property_exists($attacker, 'ship_type_id') ?
                        $attacker->ship_type_id : null,
                    'weapon_type_id'  => property_exists($attacker, 'weapon_type_id') ?
                        $attacker->weapon_type_id : null,
                ]);
            });

            if (property_exists($detail->victim, 'items')) {

                collect($detail->victim->items)->each(function ($item) use ($killmail_id) {

                    KillmailVictimItem::firstOrNew([
                        'killmail_id'  => $killmail_id,
                        'item_type_id' => $item->item_type_id,
                    ])->fill([
                        'quantity_destroyed' => property_exists($item, 'quantity_destroyed') ?
                            $item->quantity_destroyed : null,
                        'quantity_dropped'   => property_exists($item, 'quantity_dropped') ?
                            $item->quantity_dropped : null,
                        'singleton'          => $item->singleton,
                        'flag'               => $item->flag,
                    ])->save();

                    // TODO: Process $item->items as a nested model.
                });
            }
        });
    }
913089
public function handle()
    {
        $tableName = $this->argument('table');
        $filePath  = $this->argument('file_path');

        $includeId = $this->option('include_id');

        $columnNames = [];

        $columnInformation = \DB::select('show columns from '.$tableName);
        if (!empty($this->option('columns'))) {
            $columnNames = explode(',', $this->option('columns'));
        } else {
            if ($includeId) {
                $columnNames[] = 'id';
            }
            foreach ($columnInformation as $entity) {
                if ($entity->Field !== 'id') {
                    $columnNames[] = $entity->Field;
                }
            }
        }
        $defaultValues = [];
        foreach ($columnInformation as $entity) {
            if ($entity->null === 'NO') {
                $type = $entity->Type;
                if (Str::startsWith($type, 'varchar') || Str::startsWith($type, 'char') || Str::startsWith($type, 'text')) {
                    $defaultValues[$entity->Field] = '';
                } else {
                    $defaultValues[$entity->Field] = 0;
                }
            }
        }

        $excel = app()->make(Excel::class);
        $excel->filter('chunk')->load($filePath)->chunk(250, function($results) use ($tableName, $columnNames, $defaultValues) {
            foreach ($results as $row) {
                $data = [];
                foreach ($columnNames as $columnName) {
                    if ($row->has($columnName) && !empty($row->get($columnName))) {
                        $data[$columnName] = $row->get($columnName);
                    } elseif (array_key_exists($columnName, $defaultValues)) {
                        $data[$columnName] = $defaultValues[$columnName];
                    }
                }
                \DB::table($tableName)->insert($data);
            }
        });

        return true;
    }