BrianHenryIE / strauss

Prefix PHP namespaces and classnames to allow multiple versions of libraries to exist without conflict.
https://brianhenryie.github.io/strauss/
MIT License
143 stars 23 forks source link

Add ability to retrieve plain version from PHAR #92

Open JasonTheAdams opened 8 months ago

JasonTheAdams commented 8 months ago

Our team uses the PHAR version to run Strauss to avoid dependency issues. When our build system goes to run Strauss, it checks of the PHAR is available locally, and then downloads it if not before running it. The risk, here, is that devs may have an old downloaded version. To get around this, we make a file that stores the downloaded version.

There's currently a --version flag that can be used, but it outputs something like:

strauss 0.16.0

It would be helpful to have a --plain-version (or equivalent) flag that strictly outputs the version so we can easily do a version check:

php strauss.phar --plain-version
---
0.16.0
BrianHenryIE commented 7 months ago

Hey. I'm not sure it's worth adding code for that, it's so simple in Bash:

$ strauss_version=$(strauss --version | sed 's/strauss //')
$ echo $strauss_version;
0.17.0
$ strauss --version | awk '{print $2}'
0.17.0

Edit: the --version command is a Symfony Console command, so you can trust it will always be the format: sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion()) Application.php#L480

JasonTheAdams commented 7 months ago

Hey Brian! Appreciate the input.

That assumes the context and circumstance. Is there a downside to having this? You mention Symfony, just a couple methods up from that code is the ability to get just the version in Symfony. There are different use cases for just getting the version versus getting a human-readable version.