public function execute($buildName) { $prefix = Config::getVersionInstallPrefix($buildName); if (!file_exists($prefix)) { throw new Exception("{$prefix} does not exist."); } $prompter = new \CLIFramework\Prompter(); $answer = $prompter->ask("Are you sure to delete {$buildName}?", array('Y', 'n'), 'Y'); if (strtolower($answer) == "y") { Utils::recursive_unlink($prefix, $this->logger); $this->logger->info("{$buildName} is removed. I hope you're not surprised. :)"); } else { $this->logger->info("Let me guess, you drunk tonight."); } }
<?php /* * This file is part of the CLIFramework package. * * (c) Yo-An Lin <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * */ require 'vendor/autoload.php'; $prompter = new CLIFramework\Prompter(); $line = $prompter->ask('Your Name:', array('John', 'Mary')); echo "input value: "; var_dump($line);
<?php /* * This file is part of the CLIFramework package. * * (c) Yo-An Lin <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * */ require 'vendor/autoload.php'; $prompter = new CLIFramework\Prompter(); $line = $prompter->password('Your Password:'); echo "input value: "; var_dump($line);