Skip to content

Instantly share code, notes, and snippets.

@JacobSanford
Last active April 29, 2017 13:27
Show Gist options
  • Save JacobSanford/1448fece856be371060d0f16ccb1b194 to your computer and use it in GitHub Desktop.
Save JacobSanford/1448fece856be371060d0f16ccb1b194 to your computer and use it in GitHub Desktop.

Install DockWorker Alias

Adding an alias to your development instance makes working with dockworker easier.

Fish Shell

Create ~/.config/fish/functions/dockworker.fish:

function dockworker --description "DockWorker Tool Alias"
    if test -n (git rev-parse --show-cdup)
        set --global GIT_ROOT (git rev-parse --show-cdup)
    else
        set --global GIT_ROOT "."
    end

    if test -f $GIT_ROOT/vendor/bin/dockworker
        eval $GIT_ROOT/vendor/bin/dockworker $argv
    else
        echo "You must run this command from within a DockWorker project repository."
    end
end

Bash Shell

In ~/.profile, add:

function dockworker() {
  if [ "`git rev-parse --show-cdup 2> /dev/null`" != "" ]; then
    GIT_ROOT=$(git rev-parse --show-cdup)
  else
    GIT_ROOT="."
  fi

  if [ -f "$GIT_ROOT/vendor/bin/dockworker" ]; then
    $GIT_ROOT/vendor/bin/dockworker "$@"
  else
    echo "You must run this command from within a DockWorker project repository."
    return 1
  fi
}

Execute source ~/.profile to load the profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment