Get the command name without the junk.

@param  string  $command
@return string
491866
protected function filterArtisanCommand($command)
    {
        $parts = explode(" ", $command);

        if (isset($parts[2])) {
            if (str_contains(strtolower($parts[0]), 'php') && str_contains(strtolower($parts[1]), 'artisan')) {
                unset($parts[0]);
                unset($parts[1]);
                return implode(" ", $parts);
            }
        }

        return $command;
    }
991844
protected function getRequestURI($command)
    {
        if (empty($this->module)) {
            throw new \RuntimeException('Zoho CRM module is not set.');
        }
        $parts = [$this->baseUri, $this->format, $this->module, $command];

        return implode('/', $parts);
    }
141082
private function getDescriptionFromCommand(string $commandName): string
    {
        $commands = $this->consoleKernel->all();
        if (!isset($commands[$commandName])) {
            return '';
        }

        try {
            $className = get_class($commands[$commandName]);
            $reflection = new \ReflectionClass($className);
            return (string)$reflection->getDefaultProperties()['description'];
        } catch (\ReflectionException $exception) {
            return '';
        }
    }
977988
public static function routeCommand($command = 'help')
	{
		// Aliases take precedence, so parse for them first
		if ($aliases = Config::get('aliases'))
		{
			if (array_key_exists($command, $aliases))
			{
				if (strpos($aliases->$command, '::') !== false)
				{
					$bits      = explode('::', $aliases->$command);
					$command   = $bits[0];
					$aliasTask = $bits[1];
				}
				else
				{
					$command = $aliases->$command;
				}
			}
		}

		foreach (self::$commandNamespaces as $namespace)
		{
			// Check if we're targeting a namespaced command
			$bits = [];
			if (strpos($command, ':'))
			{
				$bits = explode(':', $command);
			}
			else
			{
				$bits[] = $command;
			}

			$bits = array_map('ucfirst', $bits);

			// Replace any inset placeholders
			for ($i = 0; $i < count($bits); $i++)
			{
				$loc = $i + 1;
				if (strpos($namespace, "{\$$loc}"))
				{
					$namespace = str_replace("{\$$loc}", $bits[$i], $namespace);
					unset($bits[$i]);
				}
			}

			// Add any remaining bits to the end of the command namespace
			if (count($bits) > 0)
			{
				$namespace .= '\\' . implode('\\', $bits);
			}

			// Check for existence
			if (class_exists($namespace))
			{
				$class = $namespace;
				break;
			}
		}

		if (!isset($class))
		{
			throw new UnsupportedCommandException("Unknown command: {$command}.");
		}

		return $class;
	}
1123938
private function getCommandString($command, array $arguments)
    {
        $list = array();
        $this->flatten($arguments, $list);

        return trim(strtoupper($command).' '.implode(' ', $list));
    }
233120
protected function getKeyFromScriptingCommands(string $command, array $arguments)
    {
        $keys = \array_slice($arguments, 2, $arguments[1]);

        if ($keys && $this->checkSameSlotForKeys($keys)) {
            return $keys[0];
        }

        return null;
    }
284270
public static function parseCommand($command)
    {
        if (preg_match('/([\w\\\\]+)::(\w+)\((.*)\)/', $command, $match)) {
            $params = explode(',', $match[3]);
            if ((1 == count($params)) && ('' == $params[0])) {
                //prevents to pass an empty string
                $params[0] = null;
            }
            return array(
                $match[1],
                $match[2],
                $params
            );
        }

        throw new TaskManagerException('Command not recognized');
    }
628310
private function getRealCommandName($file)
    {
        $iter = CommandLine\Commands::getInstance();
        $commands = array();
        foreach ($iter as $name => $data) {
            $commands[$name] = $data;
        }
        ksort($commands);

        if (!file_exists($file)) {
            foreach ($commands as $command) {
                if (is_array($command["command"]["aliases"]) && in_array($file, $command["command"]["aliases"])) {
                    return $command["command"]["name"];
                }
            }
        }

        return $file;
    }
1327031
private function getOutputFilterRegex($command)
    {
        $commandCharacters = str_split(preg_quote($command, '/'));
        $commandCharacterRegexWhitespaceFunction = function ($value) {
            if ($value !== '\\') {
                $value .= '\s?';
            }

            return $value;
        };

        $commandCharacters = array_map($commandCharacterRegexWhitespaceFunction, $commandCharacters);

        return sprintf('/%s(.*)%s/s', implode('', $commandCharacters), substr($this->getShellPromptRegex(), 1, -1));
    }
34142
private function getCommandLabel(CommandInterface $command)
    {
        if (null === $label = $command->getLabel()) {
            $label = $command->getName();
        }

        $label = $this->translate($label);

        return \is_array($label) ? $label[0] : $label;
    }
774847
public function resolve(Command $command)
    {
        $commandName = get_class($command);

        // Find the CommandHandler if it has been manually defined using pushHandler()
        foreach ($this->handlers as $handlerCommand => $handler) {
            if ($handlerCommand == $commandName) {
                return $handler;
            }
        }

        // If the Command also implements CommandHandler, then it can handle() itself
        if ($command instanceof CommandHandler) {
            return $command;
        }

        // Try and guess the handler's name in the same namespace with suffix "Handler"
        $class = $commandName . 'Handler';
        if (class_exists($class)) {
            return $this->container->make($class);
        }

        // Try and guess the handler's name in nested "Handlers" namespace with suffix "Handler"
        $classParts = explode('\\', $commandName);
        $commandNameWithoutNamespace = array_pop($classParts);
        $class = implode('\\', $classParts) . '\\Handlers\\' . $commandNameWithoutNamespace . 'Handler';
        if (class_exists($class)) {
            return $this->container->make($class);
        }

        throw new UnresolvableCommandHandlerException('Could not resolve a handler for [' . get_class($command) . ']');
    }
684671
public function processCommand($command)
    {
        // Add environment flag to commands
        $stage = $this->connections->getCurrentConnectionKey()->stage;
        if (Str::contains($command, 'artisan') && $stage) {
            $command .= ' --env="'.$stage.'"';
        }

        return $command;
    }
525016
public function getCommandCallbacks($command = null)
    {
        $result = array();
        if($command)
        {
            if(isset($this->__command_callbacks[$command])) {
                $result = $this->__command_callbacks[$command];
            }
        }
        else $result = $this->__command_callbacks;

        return $result;
    }
137799
private function _generateCode($command)
	{
		$code = "<?php" . PHP_EOL .
				$command . PHP_EOL;

		if ($this->options['cleanup']) {
			$code .= "unlink('" . end($this->savedFiles) . "');";
		}

		return $code;
	}
1364988
@Nonnull
    public String getCommandName() {
        String c = commandName;
        if (c != null)
            return c;
        return getArchitecture().getCommand();
    }
480116
function nameOfCommand(cmd) {
  if (!cmd) return "no command!";
  if (Array.isArray(cmd)) return nameOfCommand(cmd[0]);
  if (typeof cmd === "string") return cmd;
  if (cmd.name) return cmd.name;
  if (cmd.command) return cmd.command;
  return "unknown command, no name";
}
463404
private function run (string $command) : ?string
    {
        $result = \trim(\shell_exec($command) ?? "");

        return "" !== $result
            ? $result
            : null;
    }