Search code examples
ddev

Web command to pass arguments to ddev exec?


Nowadays most CMS provide some kind of cli interface, like ./typo3cms or in the case of craft ./craft.

Instead of running ddev exec ./craft do/something, I'd like to add a web command craft that tunnels that do/something, so I can just write ddev craft do/something.

I understand this is nice to have :-)

But can I have it?


Solution

  • It's a nice to have that you can, in fact, have right now. Check out the documentation on custom commands: https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/

    Your integration would look something like this:

    #!/bin/bash
    
    ## Description: Run craft inside the web container
    ## Usage: craft [flags] [args]
    ## Example: "ddev craft some command"
    
    craft $@