Get command line message.

@param string $cmd          Message text.
@param string $comment      Comment text.
@param int    $commentColor Comment text color.
@param int    $cmdColor     Comment text color.

@return string
326143
public static function commandLine(
            $cmd,
            $comment = '',
            $commentColor = Console::FG_BROWN,
            $cmdColor = Console::FG_GREEN
        )
        {
            $messageLength = strlen($cmd) + 3;
            $startPosition = self::COMMENT_START_POSITION;

            return self::colorize('  ' . $cmd, $cmdColor) .
            self::tab($startPosition, $messageLength) .
            self::colorize($comment, $commentColor) .
            PHP_EOL;
        }
977600
public function format_message_text($cm, $post) {
        $context = \context_module::instance($cm->id);
        $message = file_rewrite_pluginfile_urls(
            $post->message,
            'pluginfile.php',
            $context->id,
            'mod_forum',
            'post',
            $post->id,
            [
                'includetoken' => true,
            ]);
        $options = new \stdClass();
        $options->para = true;
        $options->context = $context;
        return format_text($message, $post->messageformat, $options);
    }
107175
private function Run_Cmd($_cmd, $_args = '')
    {
        if ( $_args != '' )
        {
            if ( $_cmd == '' ) $_cmd = $_args;
            else $_cmd = $_cmd." ".$_args;
            //$_cmd == ''?$_cmd = $_args:$_cmd." ".$_args;
        }

        fputs($this->Smtp_Socket, $_cmd."\r\n");
        return $this->Smtp_Ok();  //return the response code
    }
355558
public static String getHelpText(IBotCommand...botCommands) {
		StringBuilder reply = new StringBuilder();
		for (IBotCommand com : botCommands) {
			reply.append(com.toString()).append(System.lineSeparator()).append(System.lineSeparator());
		}
		return reply.toString();
	}
553825
protected function _commandCommentstatus($command)
    {
        $entity = $this->getController()->getItem();

        $label = $entity->openToComment ? AnTranslator::_('LIB-AN-ACTION-CLOSE-COMMENTING') : AnTranslator::_('LIB-AN-ACTION-OPEN-COMMENTING');
        $status = $entity->openToComment ? 0 : 1;

        $command->append(array('label' => $label))
        ->href($entity->getURL())
        ->class('action-commentstatus')
        ->setAttribute('data-action', 'commentstatus')
        ->setAttribute('data-status', $status);
    }
1230211
protected function _line( $message, $label, $color, $handle = STDOUT ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Used in third party extensions.
		if ( class_exists( 'cli\Colors' ) ) {
			$label = \cli\Colors::colorize( "$color$label:%n", $this->in_color );
		} else {
			$label = "$label:";
		}
		$this->write( $handle, "$label $message\n" );
	}
286850
public function command($cmd, $q = '', $cb = null)
    {
        if ($this->state !== self::STATE_AUTH_OK) {
            return false;
        }

        $this->sendPacket($cmd, $q);

        $this->onResponse->push($cb);
        $this->checkFree();

        return true;
    }
1112197
public function getComment()
    {
        if ($this->comment === null) {
            $match = [];
            preg_match(self::$REGEX_COMMENT, $this->output, $match);
            $this->comment = array_key_exists(2, $match) ? trim($match[2]) : '';
        }

        return $this->comment;
    }
1112357
private function getCLICommandArguments()
    {
        $command = '';
        $combinedArguments = array_merge($this->globalCommandArguments, $this->commandArguments);
        if (count($combinedArguments) > 0) {
            $command .= ' ' . implode(' ', array_map('escapeshellarg', $combinedArguments));
        }
        return $command;
    }
1092014
public function colored($text, $color)
    {
        $colors = [
            'black'  => '0;30',
            'red'    => '0;31',
            'green'  => '0;32',
            'blue'   => '1;34',
            'yellow' => '1;33'
        ];

        $c = (
            array_key_exists($color, $colors)
            ? $colors[$color]
            : $colors['black']
        );

        if ($this->arguments->{'no-colors'}) {
            return $text;
        } else {
            return "\033[". $c . 'm' . $text . "\033[0m";
        }
    }
764518
def postcmd(self, stop, line):
        '''  '''
        self.color_prompt()
        return Cmd.postcmd(self, stop, line)
69289
public static function color($text, $color)
    {
        if (isset(ShellTool::$colors[$color])) {
            return ShellTool::$colors[$color]['start'] . $text . ShellTool::$colors[$color]['close'];
        } else {
            return $text;
        }
    }
560960
public function getCommand()
    {
        return sprintf(
            "put %d %d %d %d",
            $this->_priority,
            $this->_delay,
            $this->_ttr,
            strlen($this->_message)
        );
    }
1144645
protected final void printCommandLine(@Nonnull String[] cmd, @CheckForNull FilePath workDir) {
        StringBuilder buf = new StringBuilder();
        if (workDir != null) {
            buf.append('[');
            if(showFullPath)
                buf.append(workDir.getRemote());
            else
                buf.append(workDir.getRemote().replaceFirst("^.+[/\\\\]", ""));
            buf.append("] ");
        }
        buf.append('$');
        for (String c : cmd) {
            buf.append(' ');
            if(c.indexOf(' ')>=0) {
                if(c.indexOf('"')>=0)
                    buf.append('\'').append(c).append('\'');
                else
                    buf.append('"').append(c).append('"');
            } else
                buf.append(c);
        }
        listener.getLogger().println(buf.toString());
        listener.getLogger().flush();
    }
945772
function findMessage( $context, $source, $comment = null )
    {
        $num = $this->pick( $context, $source, $comment );
        if ( $num >=0 and $num <= count( $this->Handlers ) )
        {
            $handler = $this->Handlers[$num];
            return $handler->findMessage( $context, $source, $comment );
        }
        $retValue = null;
        return $retValue;
    }
1079986
protected function colorize($message, $color = null)
    {
        if (!$color) {
            return $message;
        }

        // Create tag
        $tag = in_array($color, ['error', 'comment', 'info'], true) ? $color : 'fg='.$color;

        return sprintf('<%s>%s</%s>', $tag, $message, $tag);
    }
1008818
private function buildCmdInfo($cmdName, $cmdClass) {
        $refObj = new ReflectionClass($cmdClass);
        $docComment = $refObj->getDocComment();
        $firstLineComment = $this->extractFirstLine($docComment);

        return str_pad($cmdName, 25, ' ') . $firstLineComment . "\n";
    }