本文整理汇总了PHP中Illuminate\Console\Command::line方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::line方法的具体用法?PHP Command::line怎么用?PHP Command::line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Command
的用法示例。
在下文中一共展示了Command::line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new installer instance.
*
* @param \Illuminate\Console\Command $command
* @return void
*/
public function __construct($command)
{
$this->command = $command;
$this->command->line('Installing JavaScript & Less Assets: <info>✔</info>');
$this->command->line('Installing Language Files: <info>✔</info>');
$this->command->line('Installing Views: <info>✔</info>');
}
示例2: __construct
/**
* Create a new installer instance.
*
* @param \Illuminate\Console\Command $command
* @return void
*/
public function __construct($command)
{
$this->command = $command;
$this->command->line('Updating Routes File: <info>✔</info>');
$this->command->line('Updating Controllers: <info>✔</info>');
$this->command->line('Updating Middleware: <info>✔</info>');
$this->command->line('Updating HTTP Kernel: <info>✔</info>');
}
示例3: fire
/**
* Clear the settings cache, and backup the databases.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function fire(Command $command)
{
$command->line('Clearing settings cache...');
$this->cache->clear();
$command->line('Settings cache cleared!');
$command->line('Backing up database...');
try {
$command->call('db:backup', ['--compression' => 'gzip', '--database' => $this->config->get('database.default'), '--destination' => 'local', '--destinationPath' => Carbon::now()->format('Y-m-d H.i.s'), '--no-interaction' => true]);
} catch (Exception $e) {
$command->error($e->getMessage());
$command->line('Backup skipped!');
}
$command->line('Backup completed!');
}
示例4: check
public function check($release)
{
$this->command->line('Lastest version found is <info>' . $release . '</info>
Current version is <info>' . $this->getSparkVersion() . '</info>' . PHP_EOL);
if ($this->supported($release)) {
$this->command->line('Release ' . $release . ' is Hexavel compatible: <info>✔</info>');
return true;
}
$this->command->line('<error>Version ' . $release . ' is not yet considered Hexavel compatible</error>' . PHP_EOL);
$this->command->line('This <fg=red;options=bold;>might break your application</> but you can continue at your own risk. If you have not already, try updating Hexavel-Spark via \'composer update\'.');
if (!$this->command->confirm('Do you wish to still continue? [y|N]')) {
return false;
}
return true;
}
示例5: line
/**
* Uses the bound Command object to output text to the screen.
* If there is no Command object bound, it simply does nothing.
*
* @param string The string to output
*
* @return void
*/
protected function line($string)
{
if (!$this->output) {
return false;
}
$this->output->line($string);
}
示例6: run
/**
* Run the installation process.
*
* @return \Symfony\Component\Process\Process
*/
public function run()
{
$process = $this->getProcess();
$process->setTimeout($this->timeout);
if ($this->console instanceof Command) {
$process->run(function ($type, $line) {
$this->console->line($line);
});
}
return $process;
}
示例7: execWithOutput
public function execWithOutput(string $cmd, Command $console)
{
// Setup the file descriptors
$descriptors = [0 => ['pipe', 'w'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']];
// Start the script
$proc = proc_open($cmd, $descriptors, $pipes);
// Read the stdin
$stdin = stream_get_contents($pipes[0]);
fclose($pipes[0]);
// Read the stdout
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
// Read the stderr
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
// Close the script and get the return code
$return_code = proc_close($proc);
if ($stdin) {
$console->line($stdin);
}
if ($stdout) {
$console->line($stdout);
}
if ($stderr) {
$console->line($stderr);
}
if (strpos($stdout, 'continue?')) {
$console->error('A confirmation has been asked during the shell command execution.');
$console->error('Please manually execute the command "' . $cmd . '" to treat that particular case.');
return exit;
}
if ($return_code) {
$console->error('Error exit code : ' . $return_code);
if (!$console->ask('Do you want continue the script execution ? [Y/n]', true)) {
return exit;
}
}
}
示例8: publish
/**
* Publish something.
*/
public function publish()
{
$sourcePath = $this->getSourcePath();
if (!$this->isDirectory($sourcePath)) {
return;
}
if (!$this->isDirectory($destinationPath = $this->getDestinationPath())) {
$this->makeDirectory($destinationPath, 0775, true);
}
if ($this->copyDirectory($sourcePath, $destinationPath) && $this->showMessage) {
$this->console->line("<info>Published</info>: {$this->module->getStudlyName()}");
} else {
$this->console->error($this->error);
}
}
示例9: publish
/**
* Publish something.
*/
public function publish()
{
if (!$this->console instanceof Command) {
$message = "The 'console' property must instance of \\Illuminate\\Console\\Command.";
throw new \RuntimeException($message);
}
if (!$this->getFilesystem()->isDirectory($sourcePath = $this->getSourcePath())) {
return;
}
if (!$this->getFilesystem()->isDirectory($destinationPath = $this->getDestinationPath())) {
$this->getFilesystem()->makeDirectory($destinationPath, 0775, true);
}
if ($this->getFilesystem()->copyDirectory($sourcePath, $destinationPath)) {
if ($this->showMessage == true) {
$this->console->line("<info>Published</info>: {$this->module->getStudlyName()}");
}
} else {
$this->console->error($this->error);
}
}
示例10: pick_from_list
/**
* Present a list of choices to user, return choice
* @param Command $command The command requesting input
* @param array $choices List of choices
* @param int $default Default choice (1-array size), -1 to abort
* @param string $abort String to tag on end for aborting selection
* @return int -1 if abort selected, otherwise one greater than $choice index
* (in other words, choosing $choice[0] returns 1)
* @throws InvalidArgumentException If argument is invalid
*/
function pick_from_list(Command $command, $title, array $choices, $default = 0, $abort = null)
{
if ($abort) {
$choices[] = $abort;
}
$numChoices = count($choices);
if (!$numChoices) {
throw new \InvalidArgumentException("Must have at least one choice");
}
if ($default == -1 && empty($abort)) {
throw new \InvalidArgumentException('Cannot use default=-1 without $abort option');
}
if (!between($default, -1, $numChoices)) {
throw new \InvalidArgumentException("Invalid value, default={$default}");
}
$question = "Please enter a number between 1-{$numChoices}";
if ($default > 0) {
$question .= " (default is {$default})";
} elseif ($default < 0) {
$question .= " (enter to abort)";
$default = $numChoices;
}
$question .= ':';
while (1) {
$command->line('');
$command->info($title);
$command->line('');
for ($i = 0; $i < $numChoices; $i++) {
$command->line($i + 1 . ". " . $choices[$i]);
}
$command->line('');
$answer = $command->ask($question);
if ($answer == '') {
$answer = $default;
}
if (between($answer, 1, $numChoices)) {
if ($abort and $answer == $numChoices) {
$answer = -1;
}
return (int) $answer;
}
// Output wrong choice
$command->line('');
$formatter = $command->getHelperSet()->get('formatter');
$block = $formatter->formatBlock('Invalid entry!', 'error', true);
$command->line($block);
}
}
示例11: __construct
/**
* Create a new installer instance.
*
* @param \Illuminate\Console\Command $command
* @return void
*/
public function __construct($command)
{
$this->command = $command;
$this->command->line('Installing Database Migrations: <info>✔</info>');
}
示例12: writeLine
/**
* Display console message
*
* @param string $s the message to display
*
* @return void
*/
public function writeLine($s)
{
if ($this->display) {
parent::line($s);
}
}
示例13: line
/**
* Display console message
*
* @param string $string
* @param string $style
* @param null|int|string $verbosity
*
* @return void
*/
public function line($string, $style = null, $verbosity = null)
{
if ($this->display) {
parent::line($string, $style, $verbosity);
}
}
示例14: __construct
/**
* Create a new command instance.
*
* @param \Illuminate\Console\Command $command
* @param string $downloadPath
* @return void
*/
public function __construct($command, $downloadPath)
{
$this->downloadPath = $downloadPath;
$command->line('Updating Spark Directory: <info>✔</info>');
}
示例15: __construct
/**
* Create a new command instance.
*
* @param \Illuminate\Console\Command $command
* @param string $downloadPath
* @return void
*/
public function __construct($command)
{
$command->line('Removing Temporary Download Directory: <info>✔</info>');
}