Add psysh as a repl

This commit is contained in:
Greyscale 2019-07-30 21:40:36 +02:00
parent df8c169d3d
commit 924292c8ab
2 changed files with 33 additions and 0 deletions

View file

@ -4,6 +4,13 @@ RUN apt-get -qq update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install a funky cool repl.
RUN composer global require -q psy/psysh:@stable && \
ln -s /root/.composer/vendor/psy/psysh/bin/psysh /usr/local/bin/repl && \
/usr/local/bin/repl -v
COPY psysh-config.php /root/.config/psysh/config.php
# On build, add anything in with Dockerfile into /app
ONBUILD ADD ./ /app

26
php+cli/psysh-config.php Normal file
View file

@ -0,0 +1,26 @@
<?php
$autoloadersThatMayExist = [
'/app/vendor/autoload.php',
'/app/bootstrap.php',
];
$defaultIncludes = [];
foreach($autoloadersThatMayExist as $autoloader){
if(file_exists($autoloader)){
$defaultIncludes[] = $autoloader;
}
}
$animals = ['🐟', '🐁', '🐄', '🐆', '🐉', '🐍', '🐌', '🐋', '🐊','🐕','🐔', '🐒','🐢'];
return [
'commands' => [
new \Psy\Command\ParseCommand,
],
'defaultIncludes' => $defaultIncludes,
'startupMessage' => sprintf('You are on <error>%s</error> Uptime: <info>%s</info>', trim(shell_exec('hostname')), trim(shell_exec('uptime -p'))),
//'prompt' => $animals[array_rand($animals)],
'updateCheck' => 'never',
'useBracketedPaste' => true
];