composer-substitution-plugin
composer-substitution-plugin copied to clipboard
Replace placeholders from cli arguments
Hi,
I'm interested in replacing placeholders with arguments that are passed with the Composer command.
Here is a simple example:
"scripts": {
"welcome": "echo 'Hi {MY_NAME}, the database is {DB_STATUS}.'"
}
"extra": {
"substitution": {
"enable": true,
"mapping": {
"{MY_NAME}": {
"type": "cli-argument",
"value": "$1"
},
"{DB_STATUS}": {
"type": "cli-argument",
"value": "$2",
}
}
}
}
$ composer run-script welcome "John Doe" "OK"
Hi John Doe, the database is OK.
Is this a feature that could be added?
Hi @mdjdev,
I like the idea :)
Please open a PR if you feel comfortable, otherwise I'll try to find some time to implement it.
@villfa Thank you for your favorable response. I would appreciate it if you could take a look if you have the time.