Determines whether or not a command definition has options.

@param array $commandDef The command definition as returned from {@link Cli::getSchema()}.
@return bool Returns true if the command def has options or false otherwise.
291
protected function hasOptionsDef($commandDef) {
        return count($commandDef) > 1 || (count($commandDef) > 0 && !isset($commandDef[Cli::META]));
    }
80812
public boolean containsActionCommand(String commandId) {
        
        if (commandMap.containsKey(commandId)) {
            return true;
        }
        
        if (parent != null) {
            return parent.containsActionCommand(commandId);
        }
        
        return false;
        
    }
615846
public function hasOptionsForm()
    {
        $path = DIRNAME_SYSTEM . '/' . DIRNAME_SYSTEM_CAPTCHA . '/' . $this->sclHandle . '/' . FILENAME_FORM;
        if (file_exists(DIR_FILES_ELEMENTS . '/' . $path)) {
            return true;
        } elseif ($this->pkgID > 0) {
            $pkgHandle = $this->getPackageHandle();
            $dp = DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_ELEMENTS . '/' . $path;
            $dpc = DIR_PACKAGES_CORE . '/' . $pkgHandle . '/' . DIRNAME_ELEMENTS . '/' . $path;
            if (file_exists($dp)) {
                return true;
            } elseif (file_exists($dpc)) {
                return true;
            }
        } else {
            return file_exists(DIR_FILES_ELEMENTS_CORE . '/' . $path);
        }
    }
518361
public static function findCommandValue($args) {
		$args = explode("|",$args);
		foreach ($args as $arg) {
			if (isset(self::$options[$arg])) {
				return self::$options[$arg];
			}
		}
		return false;
	}
917295
public function getDecimalTypeDeclarationSQL(array $columnDef)
    {
        $columnDef['precision'] = ! isset($columnDef['precision']) || empty($columnDef['precision'])
            ? 10 : $columnDef['precision'];
        $columnDef['scale']     = ! isset($columnDef['scale']) || empty($columnDef['scale'])
            ? 0 : $columnDef['scale'];

        return 'NUMERIC(' . $columnDef['precision'] . ', ' . $columnDef['scale'] . ')';
    }
709868
protected function hasFieldDefinition(Type $type, FieldDefinition $fieldDef)
    {
        foreach ($type->fieldDefinitions as $existFieldDef) {
            if ($existFieldDef->id == $fieldDef->id) {
                return true;
            }
        }

        return false;
    }
568767
private function checkRequired(array $options, array $keys)
    {
        $missing = array_keys(array_diff_key(array_flip($keys), $options));

        if (!empty($missing)) {
            throw CommandException::missingOptions($missing);
        }
    }
472388
public function hasOptionalArgument($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');

        if ($this->hasOptionalArg) {
            return true;
        }

        if ($includeBase && $this->baseFormat) {
            return $this->baseFormat->hasOptionalArgument();
        }

        return false;
    }
1319908
def has_command(self, command):
        """"""
        for pbt in self._plugins.values():
            if pbt.command == command:
                return True
        return False
987378
public function validate()
    {
        if ($this->binary === false) {
            throw new CommandException("Command not found.");
        }

        if (!is_executable($this->binary)) {
            throw new CommandException("$this not executable.");
        }

        $nargs = false;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                if ($nargs) {
                    throw new CommandException("Multiple nargs detected.");
                }

                $nargs = true;
            }
        }
    }
1237604
protected function conditionMatched(CommandInterface $command): bool
    {
        $matchedConditions = true;
        foreach ($command->getConditions() as $condition) {
            if (!$condition->match($this->commandExitCodes)) {
                $matchedConditions = false;
            }
        }

        return $matchedConditions;
    }
986493
public function is_cli(){
    if ( !isset($this->cli) ){
      $this->cli = (php_sapi_name() === 'cli');
      if ( $this->cli ){
        $opt = getopt('', ['cli']);
        if ( isset($opt['cli']) ){
          $this->cli = 'direct';
        }
      }
    }
    return $this->cli;
  }
28728
public function hasOptions(array $options) {
        $all = true;

        foreach ($options as $option) {
            if (!isset($this->_options[$option])) {
                $all = false;
            }
        }

        return $all;
    }
1353420
private function mergeTableDefs(array $tableDef, array $alterDef) {
        $result = $tableDef;

        if ($this->findPrimaryKeyIndex($alterDef['add']['indexes'])) {
            $remove = null;
            foreach ($result['indexes'] as $i => $index) {
                if ($index['type'] === Db::INDEX_PK) {
                    $remove = $i;
                }
            }
            if ($remove !== null) {
                unset($result['indexes'][$i]);
            }
        }

        $result['columns'] = array_merge($result['columns'], $alterDef['def']['columns']);
        $result['indexes'] = array_merge($result['indexes'], $alterDef['add']['indexes']);

        return $result;
    }
1161018
private function findNearestCommand($commandName, array $commands)
    {
        $distances = [];
        foreach (array_keys($commands) as $command) {
            $distances[$command] = levenshtein($commandName, $command);
        }

        $distances = array_filter(array_unique($distances), function ($distance) {
            return $distance <= 3;
        });

        if (empty($distances)) {
            return false;
        }

        return array_search(min($distances), $distances);
    }
1216387
public function findCommand(array $commands, $commandName) {
        $matches = [];

        foreach ($commands as $command) {
            if ($this->compareCommandName($command->getName(), $commandName)) {
                $matches[] = $command;
            }
        }

        if (count($matches) === 1) {
            return $matches[0];
        } else if (count($matches) === 0) {
            throw new CommandNotFoundException(s(
                'Could not find a command that matches "%s".',
                $commandName
            ));
        } else {
            $qualifiedCommandNames = '';

            foreach ($matches as $command) {
                $qualifiedCommandNames .= "\n" . $command->getName();
            }

            throw new AmbiguousCommandException(s(
                'Please be more precise with the command name. ' .
                'There are several commands that qualify for "%s": %s',
                $commandName,
                $qualifiedCommandNames
            ));
        }
    }
247527
protected function isCommandDisabled($command) {
    $disabled_commands = $this->getDisabledCommands();
    if (is_array($disabled_commands) && array_key_exists($command, $disabled_commands) && $disabled_commands[$command]) {
      $this->logger->warning("The $command command is disabled.");
      return TRUE;
    }

    return FALSE;
  }