It is possible to extend fin with custom commands (per project).
-
Create a custom command
File
.docksal/commands/updb
(Notice no extension. Script name should match command name)#!/bin/bash ## Runs drush updb ## ## Usage: fin updb [params to passthrough] fin drush updb $1
-
Set executable bit:
chmod +x .docksal/commands/updb
-
Use as regular fin command:
fin updb
-
Passing parameters also works:
fin updb -y
-
See command description in
fin help
and command full help viafin help updb
These environment variables are available for use inside you custom command scripts:
PROJECT_ROOT
- absolute path to.docksal
folderYML_PATH
- absolute path todocker-compose.yml
. Usually equals PROJECT_ROOT but can be empty is yml is not found.DOCKER_RUNNING
- string values "true" and "false"
Example init
command:
#!/usr/bin/env bash
## Initialize site
if [ -z "$YML_PATH"]; then
cp docker-compose.yml.dist docker-compose.yml
fi
# Start containers
fin up
# Install site
fin drush site-install -y --site-name="My Drupal site"
# Get login link
cd docroot 2>dev/null
fin drush uli
fin looks for lines starting with ##
for command documentation.
## Custom command description
## Usage: fin mycommand [--force]
## Parameters:
## --force Try really hard
fin will output first line of custom command documentation as a short decription in fin help
.
Rest of lines will be available as advanced help via fin help command_name
See example of command documentation in phpcs command
Put your command to ~/.docksal/commands
and it will be accessible globally.
Useful for tedious tasks that you need in every project.
It is not imperative to use bash. You can use any interpreter for your custom command scripts
#!/usr/bin/env python
print "Custom python command!"
#!/usr/bin/env node
/*
## Custom node command description
*/
console.log("Custom NodeJS command!")