当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::line方法代码示例

本文整理汇总了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>');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:13,代码来源:InstallResources.php

示例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>');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:14,代码来源:InstallHttp.php

示例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!');
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:21,代码来源:CommandSubscriber.php

示例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;
 }
开发者ID:peterfox,项目名称:hexavel-spark,代码行数:15,代码来源:CheckCompatibility.php

示例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);
 }
开发者ID:Vicimus,项目名称:Twicimus,代码行数:15,代码来源:TwitterRest.php

示例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;
 }
开发者ID:musaid,项目名称:modules,代码行数:16,代码来源:Installer.php

示例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;
         }
     }
 }
开发者ID:Okipa,项目名称:una.app,代码行数:38,代码来源:ConsoleHelper.php

示例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);
     }
 }
开发者ID:arcanedev,项目名称:workbench,代码行数:18,代码来源:Publisher.php

示例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);
     }
 }
开发者ID:Avantinternet,项目名称:modules,代码行数:23,代码来源:Publisher.php

示例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);
    }
}
开发者ID:tashakau,项目名称:getting-stuff-done-laravel-code,代码行数:58,代码来源:helpers.php

示例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>');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:InstallMigrations.php

示例12: writeLine

 /**
  * Display console message
  *
  * @param   string $s the message to display
  *
  * @return  void
  */
 public function writeLine($s)
 {
     if ($this->display) {
         parent::line($s);
     }
 }
开发者ID:potsky,项目名称:laravel-localization-helpers,代码行数:13,代码来源:LocalizationAbstract.php

示例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);
     }
 }
开发者ID:torann,项目名称:localization-helpers,代码行数:15,代码来源:LocalizationAbstract.php

示例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>');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:12,代码来源:UpdateInstallation.php

示例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>');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:11,代码来源:RemoveDownloadPath.php


注:本文中的Illuminate\Console\Command::line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。