#3223·lego

Allow to specify hook command and arguments as an array in the configuration file

Author: meineerdeCreated Aug 4, 2026Updated Aug 5, 2026
Labelsproposalarea/configarea/hooks

Welcome

  • Yes, I'm using a binary release or the library within the two latest releases.
  • Yes, I've searched for similar issues on GitHub and didn't find any.

Detailed Description

Right now, the hook commands and their arguments are strictly split on spaces. This makes it impossible to use arguments containing spaces itself:

  • #1468
  • #3098

I propose to (optionally) allow to specify the hook command and its arguments as an array in the YAML file. This would allow to unambiguously delimit arguments and would allow to use arbitrary (unescaped) arguments to hook scripts.

In the configuration file, this could look like this:

yaml
hooks:
  deploy:
    command:
      - "/opt/path with spaces/my-deploy-hook.sh"
      - "argument 1"
      - argument2
      - "argument 3"

In the YAML scheme, you could then accept either a single string or an array of strings. If the command is specified as a single string, you could still split it on spaces as before, retaining backwards compatibility. If the command is specified as an array, the executable would be the first element with all following elements provided as arguments unchanged.

Effective version of lego

v5.3.1

How do you use lego?

Binary

In which context are you using lego?

Personal and professional use

Supporting the Maintainers

  • Yes, I find this project useful, and I appreciate the work done by the maintainers.
  • Yes, I have starred this repository to help others find it.
  • Yes, I have sponsored this project to keep the project stable and maintained.

Confirmation

  • Yes, I've included all the information above (version, usage, etc.).