Added pass-through arguments to composer
command, all arguments beginning with --composer-
will be passed to the composer
command, for example --composer-dev
will be passed as --dev
to the composer
command
This commit is contained in:
parent
6381ec509c
commit
4740a77de5
2 changed files with 24 additions and 2 deletions
|
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
- Added file downloads progress
|
||||
- Added pass-through arguments to `composer` command, all arguments beginning with `--composer-` will be passed to the
|
||||
`composer` command, for example `--composer-dev` will be passed as `--dev` to the `composer` command
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -373,11 +373,31 @@ namespace ncc\Classes\ComposerExtension;
|
|||
*/
|
||||
private static function getOptions(): array
|
||||
{
|
||||
$results = [];
|
||||
$arguments = Main::getArgs();
|
||||
|
||||
// Anything beginning with --composer- is a composer option
|
||||
foreach ($arguments as $argument => $value)
|
||||
{
|
||||
if (str_starts_with($argument, 'composer-') && !in_array($argument, $results))
|
||||
{
|
||||
if(is_bool($value) && $value)
|
||||
{
|
||||
$results[] = '--' . str_ireplace('composer-', '', $argument);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$results[] = '--' . str_ireplace('composer-', '', $argument) . '=' . $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$options = Functions::getConfigurationProperty('composer.options');
|
||||
if ($options == null || !is_array($options))
|
||||
return [];
|
||||
return $results;
|
||||
|
||||
$results = [];
|
||||
if (isset($options['quiet']) && $options['quiet'])
|
||||
$results[] = '--quiet';
|
||||
if (isset($options['no_asni']) && $options['no_asni'])
|
||||
|
|
Loading…
Add table
Reference in a new issue