Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Improved the way we display the executed installer command #88

Closed
Closed
Show file tree
Hide file tree
Changes from 2 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
15 changes: 14 additions & 1 deletion src/Symfony/Installer/AboutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf($commandHelp,
$this->appVersion,
str_repeat('=', 20 + strlen($this->appVersion)),
$_SERVER['PHP_SELF']
$this->getExecutedCommand()
));
}

/**
* Returns the executed command.
*
* @return string
*/
private function getExecutedCommand()
{
$executedCommand = $_SERVER['PHP_SELF'];
$executedCommand = preg_replace('~/usr/local/bin/~', '', $executedCommand);

return $executedCommand;
}
}
5 changes: 4 additions & 1 deletion src/Symfony/Installer/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ private function getExecutedCommand()
$version = $this->version;
}

return sprintf('%s new %s %s', $_SERVER['PHP_SELF'], $this->projectName, $version);
$executedCommand = $_SERVER['PHP_SELF'];
$executedCommand = preg_replace('~/usr/local/bin/~', '', $executedCommand);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could be even smarter and check if dirname() of $_SERVER['PHP_SELF'] is one of the paths in $_SERVER['PATH']. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Done in 860c9b9.


return sprintf('%s new %s %s', $executedCommand, $this->projectName, $version);
}
}