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a5vKd N1l^2Q[.]k-Ԙ{ {b$ꨖwɷq.+`)-We3[4}Jaj-)a[T&@)F#U\wA6K:eG?pL)X?&4ꕕBj1O[2vcV5ۯiufnctMgF1@qxW@r!mD#ǴE: Sh$3nw4+(ho&\raςm ԮO)moc]nn^#L[6S-D"&0K8׸,ٽ@ό 9aTŽlJ:nr#j*2Oa#tPSQ4Ȗ47ZL.$% H1K%UnbTx"3Qg 4Z6L/UKHM&%w*%]$I)cZ94[@i@`aV(x>Ej\c6@3̒x&kK>ٰNmᄡYΪ̸FنuƱA$^7eyֲ4*K(7!5.V@^xOlI 褾=pξ˻uqxy8x 9x'E.E пYfv2j?d4Œ!^NA2n%joJb-Ri^rnUuQTehS|$6r4gfu9՘}vT];Ij%e&parser->name; $parent = $this->parser->parent; while ($parent) { if (count($parent->options) > 0) { $name = '[' . strtolower($this->parser->message_provider->get('OPTION_WORD', array('plural' => 's'))) . '] ' . $name; } $name = $parent->name . ' ' . $name; $parent = $parent->parent; } return $this->wrap($name); } // }}} // description() {{{ /** * Returns the command line description message. * * @return string The description message */ protected function description() { return $this->wrap($this->parser->description); } // }}} // usageLine() {{{ /** * Returns the command line usage message * * @return string the usage message */ protected function usageLine() { $usage = $this->parser->message_provider->get('USAGE_WORD') . ":\n"; $ret = $usage . ' ' . $this->name(); if (count($this->parser->options) > 0) { $ret .= ' [' . strtolower($this->parser->message_provider->get('OPTION_WORD')) . ']'; } if (count($this->parser->args) > 0) { foreach ($this->parser->args as $name=>$arg) { $arg_str = $arg->help_name; if ($arg->multiple) { $arg_str .= '1 ' . $arg->help_name . '2 ...'; } if ($arg->optional) { $arg_str = '[' . $arg_str . ']'; } $ret .= ' ' . $arg_str; } } return $this->columnWrap($ret, 2); } // }}} // commandUsageLine() {{{ /** * Returns the command line usage message for subcommands. * * @return string The usage line */ protected function commandUsageLine() { if (count($this->parser->commands) == 0) { return ''; } $ret = ' ' . $this->name(); if (count($this->parser->options) > 0) { $ret .= ' [' . strtolower($this->parser->message_provider->get('OPTION_WORD')) . ']'; } $ret .= " "; $hasArgs = false; $hasOptions = false; foreach ($this->parser->commands as $command) { if (!$hasArgs && count($command->args) > 0) { $hasArgs = true; } if (!$hasOptions && ($command->add_help_option || $command->add_version_option || count($command->options) > 0)) { $hasOptions = true; } } if ($hasOptions) { $ret .= ' [options]'; } if ($hasArgs) { $ret .= ' [args]'; } return $this->columnWrap($ret, 2); } // }}} // argumentList() {{{ /** * Render the arguments list that will be displayed to the user, you can * override this method if you want to change the look of the list. * * @return string The formatted argument list */ protected function argumentList() { $col = 0; $args = array(); foreach ($this->parser->args as $arg) { $argstr = ' ' . $arg->toString(); $args[] = array($argstr, $arg->description); $ln = strlen($argstr); if ($col < $ln) { $col = $ln; } } $ret = $this->parser->message_provider->get('ARGUMENT_WORD') . ":"; foreach ($args as $arg) { $text = str_pad($arg[0], $col) . ' ' . $arg[1]; $ret .= "\n" . $this->columnWrap($text, $col+2); } return $ret; } // }}} // optionList() {{{ /** * Render the options list that will be displayed to the user, you can * override this method if you want to change the look of the list. * * @return string The formatted option list */ protected function optionList() { $col = 0; $options = array(); foreach ($this->parser->options as $option) { $delim = $this->options_on_different_lines ? "\n" : ', '; $optstr = $option->toString($delim); $lines = explode("\n", $optstr); $lines[0] = ' ' . $lines[0]; if (count($lines) > 1) { $lines[1] = ' ' . $lines[1]; $ln = strlen($lines[1]); } else { $ln = strlen($lines[0]); } $options[] = array($lines, $option->description); if ($col < $ln) { $col = $ln; } } $ret = $this->parser->message_provider->get('OPTION_WORD') . ":"; foreach ($options as $option) { if (count($option[0]) > 1) { $text = str_pad($option[0][1], $col) . ' ' . $option[1]; $pre = $option[0][0] . "\n"; } else { $text = str_pad($option[0][0], $col) . ' ' . $option[1]; $pre = ''; } $ret .= "\n" . $pre . $this->columnWrap($text, $col+2); } return $ret; } // }}} // commandList() {{{ /** * Render the command list that will be displayed to the user, you can * override this method if you want to change the look of the list. * * @return string The formatted subcommand list */ protected function commandList() { $commands = array(); $col = 0; foreach ($this->parser->commands as $cmdname=>$command) { $cmdname = ' ' . $cmdname; $commands[] = array($cmdname, $command->description, $command->aliases); $ln = strlen($cmdname); if ($col < $ln) { $col = $ln; } } $ret = $this->parser->message_provider->get('COMMAND_WORD') . ":"; foreach ($commands as $command) { $text = str_pad($command[0], $col) . ' ' . $command[1]; if ($aliasesCount = count($command[2])) { $pad = ''; $text .= ' ('; $text .= $aliasesCount > 1 ? 'aliases: ' : 'alias: '; foreach ($command[2] as $alias) { $text .= $pad . $alias; $pad = ', '; } $text .= ')'; } $ret .= "\n" . $this->columnWrap($text, $col+2); } return $ret; } // }}} // wrap() {{{ /** * Wraps the text passed to the method. * * @param string $text The text to wrap * @param int $lw The column width (defaults to line_width property) * * @return string The wrapped text */ protected function wrap($text, $lw=null) { if ($this->line_width > 0) { if ($lw === null) { $lw = $this->line_width; } return wordwrap($text, $lw, "\n", false); } return $text; } // }}} // columnWrap() {{{ /** * Wraps the text passed to the method at the specified width. * * @param string $text The text to wrap * @param int $cw The wrap width * * @return string The wrapped text */ protected function columnWrap($text, $cw) { $tokens = explode("\n", $this->wrap($text)); $ret = $tokens[0]; $text = trim(substr($text, strlen($ret))); if (empty($text)) { return $ret; } $chunks = $this->wrap($text, $this->line_width - $cw); $tokens = explode("\n", $chunks); foreach ($tokens as $token) { if (!empty($token)) { $ret .= "\n" . str_repeat(' ', $cw) . $token; } else { $ret .= "\n"; } } return $ret; } // }}} }