Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Nov 27, 2019
2 parents 9aaf295 + 3c46dfc commit 5442009
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 15 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"php": ">=5.4.0",
"ext-json": "*",
"ext-tokenizer": "*",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0|~5.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0|~5.0",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"dnoegel/php-xdg-base-dir": "0.1",
"jakub-onderka/php-console-highlighter": "0.3.*|0.4.*"
Expand Down
2 changes: 2 additions & 0 deletions src/Command/BufferCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$output->writeln($this->formatLines($buf), ShellOutput::NUMBER_LINES);
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->write(\sprintf('%c[2J%c[0;0f', 27, 27));

return 0;
}
}
2 changes: 2 additions & 0 deletions src/Command/DocCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

// Set some magic local variables
$this->setCommandScopeVariables($reflector);

return 0;
}

private function getManualDoc($reflector)
Expand Down
2 changes: 2 additions & 0 deletions src/Command/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (\is_object($target)) {
$this->setCommandScopeVariables(new \ReflectionObject($target));
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/EditCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($execute) {
$this->getApplication()->addInput($editedContent);
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->stopPaging();
}

return 0;
}
}
4 changes: 3 additions & 1 deletion src/Command/HistoryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$type = $input->getOption('no-numbers') ? 0 : ShellOutput::NUMBER_LINES;
if (!$highlighted) {
$type = $type | ShellOutput::OUTPUT_RAW;
$type = $type | OutputInterface::OUTPUT_RAW;
}

$output->page($highlighted ?: $history, $type);
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($reflector !== null) {
$this->setCommandScopeVariables($reflector);
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ParseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->page($this->presenter->present($nodes, $depth));

$this->context->setReturnValue($nodes);

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/PsyVersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln($this->getApplication()->getVersion());

return 0;
}
}
13 changes: 8 additions & 5 deletions src/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Psy\Formatter\CodeFormatter;
use Psy\Formatter\SignatureFormatter;
use Psy\Input\CodeArgument;
use Psy\Output\ShellOutput;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -99,11 +98,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new \InvalidArgumentException('Too many arguments (supply either "target" or "--ex")');
}

return $this->writeExceptionContext($input, $output);
$this->writeExceptionContext($input, $output);

return 0;
}

if ($input->getArgument('target')) {
return $this->writeCodeContext($input, $output);
$this->writeCodeContext($input, $output);

return 0;
}

throw new RuntimeException('Not enough arguments (missing: "target")');
Expand All @@ -117,7 +120,7 @@ private function writeCodeContext(InputInterface $input, OutputInterface $output
$this->setCommandScopeVariables($reflector);

try {
$output->page(CodeFormatter::format($reflector, $this->colorMode), ShellOutput::OUTPUT_RAW);
$output->page(CodeFormatter::format($reflector, $this->colorMode), OutputInterface::OUTPUT_RAW);
} catch (RuntimeException $e) {
$output->writeln(SignatureFormatter::format($reflector));
throw $e;
Expand Down Expand Up @@ -216,7 +219,7 @@ private function writeTraceCodeSnippet(OutputInterface $output, array $trace, $i
return;
}

$output->write($this->getHighlighter()->getCodeSnippet($code, $line, 5, 5), ShellOutput::OUTPUT_RAW);
$output->write($this->getHighlighter()->getCodeSnippet($code, $line, 5, 5), false, OutputInterface::OUTPUT_RAW);
}

private function getHighlighter()
Expand Down
2 changes: 2 additions & 0 deletions src/Command/SudoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$sudoCode = $this->printer->prettyPrint($nodes);
$shell = $this->getApplication();
$shell->addCode($sudoCode, !$shell->hasCode());

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/ThrowUpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

$shell = $this->getApplication();
$shell->addCode($throwCode, !$shell->hasCode());

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/TimeitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->writeln(\sprintf(self::AVG_RESULT_MSG, $total / $num, $median, $total));
}

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/TraceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->filter->bind($input);
$trace = $this->getBacktrace(new \Exception(), $input->getOption('num'), $input->getOption('include-psy'));
$output->page($trace, ShellOutput::NUMBER_LINES);

return 0;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Command/WhereamiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use JakubOnderka\PhpConsoleHighlighter\Highlighter;
use Psy\Configuration;
use Psy\ConsoleColorFactory;
use Psy\Output\ShellOutput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -123,8 +122,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('');
$output->writeln(\sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $info['line']));
$output->writeln('');
$output->write($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), ShellOutput::OUTPUT_RAW);
$output->write($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), false, OutputInterface::OUTPUT_RAW);
$output->stopPaging();

return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Command/WtfCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
} while ($exception = $exception->getPrevious());
$output->stopPaging();

return 0;
}
}
4 changes: 2 additions & 2 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use Psy\Readline\HoaConsole;
use Psy\Readline\Libedit;
use Psy\Readline\Readline;
use Psy\Readline\Transient;
use Psy\TabCompletion\AutoCompleter;
use Psy\VarDumper\Presenter;
use Psy\VersionUpdater\Checker;
use Psy\VersionUpdater\GitHubChecker;
use Psy\VersionUpdater\IntervalChecker;
use Psy\VersionUpdater\NoopChecker;
use Symfony\Component\Console\Output\OutputInterface;

/**
* The Psy Shell configuration.
Expand Down Expand Up @@ -823,7 +823,7 @@ public function getOutput()
{
if (!isset($this->output)) {
$this->output = new ShellOutput(
ShellOutput::VERBOSITY_NORMAL,
OutputInterface::VERBOSITY_NORMAL,
$this->getOutputDecorated(),
null,
$this->getPager()
Expand Down
5 changes: 2 additions & 3 deletions src/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Psy\ExecutionLoop\RunkitReloader;
use Psy\Input\ShellInput;
use Psy\Input\SilentInput;
use Psy\Output\ShellOutput;
use Psy\TabCompletion\Matcher;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Application;
Expand All @@ -47,7 +46,7 @@
*/
class Shell extends Application
{
const VERSION = 'v0.9.9';
const VERSION = 'v0.9.10';

const PROMPT = '>>> ';
const BUFF_PROMPT = '... ';
Expand Down Expand Up @@ -931,7 +930,7 @@ public function writeStdout($out, $phase = PHP_OUTPUT_HANDLER_END)

// Incremental flush
if ($out !== '' && !$isCleaning) {
$this->output->write($out, false, ShellOutput::OUTPUT_RAW);
$this->output->write($out, false, OutputInterface::OUTPUT_RAW);
$this->outputWantsNewline = (\substr($out, -1) !== "\n");
$this->stdoutBuffer .= $out;
}
Expand Down

0 comments on commit 5442009

Please sign in to comment.