4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Readline;
14 use Hoa\Console\Readline\Readline as HoaReadline;
15 use Psy\Exception\BreakException;
18 * Hoa\Console Readline implementation.
20 class HoaConsole implements Readline
22 /** @var HoaReadline */
28 public static function isSupported()
30 return class_exists('\Hoa\Console\Console', true);
33 public function __construct()
35 $this->hoaReadline = new HoaReadline();
41 public function addHistory($line)
43 $this->hoaReadline->addHistory($line);
51 public function clearHistory()
53 $this->hoaReadline->clearHistory();
61 public function listHistory()
65 while (($item = $this->hoaReadline->getHistory($i++)) !== null) {
75 public function readHistory()
83 * @throws BreakException if user hits Ctrl+D
87 public function readline($prompt = null)
89 return $this->hoaReadline->readLine($prompt);
95 public function redisplay()
103 public function writeHistory()