0

I'm creating a starter kit for the Panopoly distro that will generate a skeleton distribution using Panopoly as a base distribution. I'm doing this with a custom drush command. The code can be seen here.

I'm using a STARTERKIT folder that contains all of the code that will be copied and go through string/token replacements. The drush command is working well however what I'm unable to figure out is how to programmatically figure out where the STARTERKIT folder is. Right now I'm relying on the user entering --include=path/to/drush.command option.

Assuming the user copies the whole project to their ~/.drush folder they can run the drush command without the --include attribute but then my command does not know where the STARTERKIT folder is.

Here is where I'm using the --include option to locate the STARTERKIT folder.

1

You could make a wrapper script panopoly_starter_kit.sh, and determine the path to the script via $0. Your script would then just run your drush command, supplying the --include variable. See the drush script for an example of how a bash script can find the directory that the script itself is located.

UPDATE:

Another option would be to use a Drush script instead of a Drush command to do your installation. You would lose your help output, but you could still process arguments and options. See drush topic docs-examplescript for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.