Closed CircleCode closed 1 year ago
I don't think options is the right place for it. Options are supposed to focus a the action execution. If it is something we will allow for all Actions
and is impacting the execution of the Cap'n then I think config
is the better suited place to configure something like that.
{
"action": "\\CaptainHook\\App\\Hook\\File\\Action\\MaxSize",
"config": {
"label": "My custom description for this action"
},
"options": {
"maxSize": "1M"
}
},
We would need to include it in Config\Action
with something like getLabel(): string
and implement it in a way that if no label is specified it will return the action
public function getLabel(): string
{
return (string) ($this->settings[Config::SETTING_LABEL] ?? $this->getAction());
}
Then we can just change the Runner
from outputting $config->getAction()
to $config->getLabel()
If you want you can provide a pull request for it, but I should be able to do this pretty quickly as well :)
I will start working on it ;)
This works from 5.16.4
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
"options": {
"subjectLength": 50,
"bodyLineLength": 72
},
"config": {
"label": "Verify commit message format"
}
}
This label would be used in the output of the hook, transforming
into
If you're ok with it, I have a local version where label could be put in action's options.
However, I did not find a test for this output.