Skip to content

Commit fb11e57

Browse files
committed
Set the command version when installed via Composer
1 parent 423d1de commit fb11e57

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/build-regexp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@ if (!class_exists('s9e\\RegexpBuilder\\Command\\Build'))
1919
}
2020
}
2121

22+
$version = '@git_tag@';
23+
if ($version[0] === '@')
24+
{
25+
$version = Composer\InstalledVersions::getPrettyVersion('s9e/regexp-builder-command');
26+
}
27+
2228
// Set the default name to match the name of this file
2329
class SingleCommand extends s9e\RegexpBuilder\Command\Build
2430
{
2531
protected static $defaultName = 'build-regexp';
2632
}
2733
$command = new SingleCommand;
2834

29-
$app = new Symfony\Component\Console\Application($command->getName(), '@git_tag@');
35+
$app = new Symfony\Component\Console\Application($command->getName(), $version);
3036
$app->add($command);
3137
$app->setDefaultCommand($command->getName(), true);
3238
$app->run();

0 commit comments

Comments
 (0)