8000 Give user correct path for `bolt:server` command by bobdenotter · Pull Request #2801 · bolt/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Give user correct path for bolt:server command #2801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Command/ServerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Process\Process;
use Webmozart\PathUtil\Path;

class ServerCommand extends Command
{
/** @var string */
private $projectDir;

public function __construct(string $projectDir)
{
$this->projectDir = $projectDir;

parent::__construct();
}

protected function configure(): void
{
$this
Expand Down Expand Up @@ -44,6 +55,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$io->comment(sprintf('You can <options=bold>%s</> a webserver by running the following command:', ($stop ? 'stop' : 'start')));

// If we're not running in the 'projectDir', give the user the correct 'cd' command too.
if (getcwd() !== $this->projectDir) {
$command = 'cd ' . Path::makeRelative($this->projectDir, getcwd()) . "/\n " . $command;
}

$io->text(sprintf($command, $port));

return Command::SUCCESS;
Expand Down
0