Handles the "module --delete" command.

@param Args $args The console arguments

@return int The status code
551567
public function handleDelete(Args $args)
    {
        $moduleName = $args->getArgument('name');

        if (!$this->moduleManager->hasModule($moduleName)) {
            throw new RuntimeException(sprintf(
                'The module "%s" is not installed.',
                $moduleName
            ));
        }

        $this->moduleManager->removeModule($moduleName);

        return 0;
    }
979251
public function untrash( $args, $assoc_args ) {
		$this->check_server_name();
		foreach ( $args as $id ) {
			$this->call( $id, __FUNCTION__, 'Untrashed', 'Failed untrashing' );
		}
	}
1237289
function cleanup($args)
    {
        // $_SESSION['compose']['attachments'] is not a complete record of
        // temporary files because loading a draft or starting a forward copies
        // the file to disk, but does not make an entry in that array
        if (is_array($_SESSION['plugins']['filesystem_attachments'])) {
            foreach ($_SESSION['plugins']['filesystem_attachments'] as $group => $files) {
                if ($args['group'] && $args['group'] != $group) {
                    continue;
                }

                foreach ((array)$files as $filename) {
                    if (file_exists($filename)) {
                        unlink($filename);
                    }
                }

                unset($_SESSION['plugins']['filesystem_attachments'][$group]);
            }
        }
        return $args;
    }
23019
public function main($argv)
    {
        $this->addArguments();
        try {
            $this->cli->arguments->parse($argv);
        } catch (\Exception $e) {
            $this->cli->usage();
            return 0;
        }
        if ($this->cli->arguments->get('help')) {
            $this->cli->usage();
            return 0;
        }
        return $this->execute();
    }
226671
public function remove($arg)
    {
        return $this->getConnection()
            ->delete($this->tableName, array($this->uniqueId => $this->create($arg)->getId())) > 0;
    }
1192562
public function handleRename(Args $args)
    {
        $moduleName = $args->getArgument('name');
        $newName = $args->getArgument('new-name');

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

        return 0;
    }
755488
public function handleUpdate(Args $args)
    {
        $flags = $args->isOptionSet('force')
            ? DiscoveryManager::OVERRIDE | DiscoveryManager::IGNORE_TYPE_NOT_FOUND
                | DiscoveryManager::IGNORE_TYPE_NOT_ENABLED
            : DiscoveryManager::OVERRIDE;

        $descriptorToUpdate = $this->getBindingByUuidPrefix($args->getArgument('uuid'));
        $bindingToUpdate = $descriptorToUpdate->getBinding();

        if (!$descriptorToUpdate->getContainingModule() instanceof RootModule) {
            throw new RuntimeException(sprintf(
                'Can only update bindings in the module "%s".',
                $this->modules->getRootModuleName()
            ));
        }

        if ($bindingToUpdate instanceof ResourceBinding) {
            $updatedBinding = $this->getUpdatedResourceBinding($args, $bindingToUpdate);
        } elseif ($bindingToUpdate instanceof ClassBinding) {
            $updatedBinding = $this->getUpdatedClassBinding($args, $bindingToUpdate);
        } else {
            throw new RuntimeException(sprintf(
                'Cannot update bindings of type %s.',
                get_class($bindingToUpdate)
            ));
        }

        $updatedDescriptor = new BindingDescriptor($updatedBinding);

        if ($this->bindingsEqual($descriptorToUpdate, $updatedDescriptor)) {
            throw new RuntimeException('Nothing to update.');
        }

        $this->discoveryManager->addRootBindingDescriptor($updatedDescriptor, $flags);

        return 0;
    }
885281
public function handleUpdate(Args $args)
    {
        $name = $args->getArgument('name');
        $descriptorToUpdate = $this->discoveryManager->getRootTypeDescriptor($name);
        $bindingParams = $descriptorToUpdate->getType()->getParameters();
        $description = $descriptorToUpdate->getDescription();
        $paramDescriptions = $descriptorToUpdate->getParameterDescriptions();

        $this->parseParamDescriptions($args, $paramDescriptions);
        $this->parseParams($args, $bindingParams);
        $this->parseUnsetParams($args, $bindingParams, $paramDescriptions);

        if ($args->isOptionSet('description')) {
            $description = $args->getOption('description');
        }

        $updatedDescriptor = new BindingTypeDescriptor(
            new BindingType($name, $bindingParams),
            $description,
            $paramDescriptions
        );

        if ($this->typesEqual($descriptorToUpdate, $updatedDescriptor)) {
            throw new RuntimeException('Nothing to update.');
        }

        $this->discoveryManager->addRootTypeDescriptor($updatedDescriptor, DiscoveryManager::OVERRIDE);

        return 0;
    }
1034604
public function handleShow(Args $args, IO $io)
    {
        $raw = !$args->isOptionSet('parsed');
        $value = $this->manager->getConfigKey($args->getArgument('key'), null, true, $raw);

        $io->writeLine(StringUtil::formatValue($value, false));

        return 0;
    }
90777
public function devMode($args){

        if(empty($args[0])){
            $mode = \Disco\manage\Manager::devMode();
            echo 'DEV_MODE : ' . (($mode) ? 'true' : 'false') . PHP_EOL;
            exit;
        }//if
        else if($args[0] != 'true' && $args[0] != 'false'){
            echo 'Mode takes one of two values: true | false' . PHP_EOL . 'Please supply a correct value' . PHP_EOL;
            exit;
        }//if

        \Disco\manage\Manager::devMode(($args[0] == 'true') ? true : false);
        echo 'DEV_MODE now set to: ' . $args[0] . PHP_EOL;

    }
69784
public function delete($_, $assoc_args)
    {
        $this->init_args(func_get_args());
        $env = $this->get_env_for_write_or_fail();

        foreach ($_ as $key) {
            if ($result = $env->remove($key)) {
                WP_CLI::success("Removed '$key'");
            } else {
                WP_CLI::warning("No line found for key: '$key'");
            }
        }

        $env->save();
    }
956383
public function delete( $args, $assoc_args ) {
		list( $id ) = $args;

		$assoc_args = wp_parse_args( $assoc_args, array(
			'delete_blogs' => false,
		) );

		$network_id = delete_network( $id, $assoc_args['delete_blogs'] );

		if ( is_wp_error( $network_id ) ) {
			WP_CLI::error( $network_id );
		}

		WP_CLI::success( sprintf( 'Deleted network %d.', $id ) );
	}
914549
private function cmdHelp($args)
    {
        $help = isset($args[1]) ? $args[1] : 'help';
        $file = __DIR__.'/../help/'.$help.'.txt';

        if (!file_exists($file)) {
            return $this->error('&help-not-found');
        }

        echo file_get_contents(__DIR__.'/../help/'.$help.'.txt');
    }
1089423
public function run(Command $command, array $args) : int
    {
        $programName = basename(array_shift($args));

        $arg = current($args);

        if ($arg === '--help') {
            $this->printUsage($command, $programName);
            return 0;
        }

        if ($arg === '--version') {
            $this->printVersion($command);
            return 0;
        }

        try {
            $changeSet = $command->createChangeSet($args);
        } catch (BadUsage $e) {
            $this->printUsage($command, $programName);
            return 1;
        }

        $loader = new ProjectLoader(getcwd());
        $loader->registerClassLoader();

        $config = $loader->getPhpCodeSnifferConfiguration();

        try {
            if ($config !== null) {
                foreach ($config as $key => $value) {
                    Config::setConfigData($key, $value, true);
                }
            }

            // pass configuration using CLI arguments to override what's defined in the rule set
            $config = new Config(array_merge($args, ['--no-cache']));
            $runner = new Runner($config);

            return $runner->run($changeSet);
        } catch (DeepExitException $e) {
            echo $e->getMessage();
            return $e->getCode();
        }
    }
87716
public function dbRestore($args){

        $path = '/app/db/';
        if(isset($args[0])){
            $path = $args[0];
        }//if

        $path = \App::path() . '/' . trim($path,'/') . '/';

        $fileName = \App::config('DB_DB');
        if(isset($args[1])){
            $fileName = $args[1];
        }//if

        $fileName = $path . $fileName . '.sql';

        if(!is_file($fileName)){
            echo "Backup `{$fileName}` does not exist, exiting." . PHP_EOL;
            exit;
        }//if

        $e = "mysql -u %1\$s -p'%2\$s' -h %3\$s %4\$s < %5\$s;";
        $e = sprintf($e,
            \App::config('DB_USER'),
            \App::config('DB_PASSWORD'),
            \App::config('DB_HOST'),
            \App::config('DB_DB'),
            $fileName
        );

        $error = exec($e);

        if(!$error){
            echo 'DB `' . \App::config('DB_DB') . "` successfully restored from `{$fileName}`";
        } else {
            echo 'Unable to restore! : ' . $error;
        }//el

        echo PHP_EOL;

    }
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;
    }
719228
public function run($args)
    {
        foreach ($this->permissions as $dir => $config) {
            $path = $this->basePath . '/' . $dir;
            if (file_exists($path)) {
                try {
                    if (isset($config['user'])) {
                        $this->changeOwner($path, $config['user']);
                    }
                    if (isset($config['group'])) {
                        $this->changeGroup($path, $config['group']);
                    }
                    if (isset($config['mode'])) {
                        $this->changeMode($path, $config['mode']);
                    }
                } catch(CException $e) {
                    echo $this->formatError($e->getMessage())."\n";
                }
            } else {
                echo sprintf("Failed to change permissions for %s. File does not exist!\n", $path);
            }
        }
        echo "Permissions successfully changed.\n";
        return 0;
    }