Skip to content

Instantly share code, notes, and snippets.

@daciomedina
Created December 14, 2021 09:39
Show Gist options
  • Save daciomedina/f652a747054ca1dabb9b3b264313442d to your computer and use it in GitHub Desktop.
Save daciomedina/f652a747054ca1dabb9b3b264313442d to your computer and use it in GitHub Desktop.
Script to add ddev command for open Dbeaver in current project - Ubuntu WSL2
#!/bin/bash
## Description: Run DBeaver against current db
## Usage: db
## Example: "ddev db"
## OSTypes: windows,wsl2
## HostBinaryExists: /mnt/c/Program Files/DBeaver/dbeaver.exe,C:\Program Files\DBeaver/dbeaver.exe
arguments="-nl es -nosplash -con \"connect=true|driver=mysql|user=root|password=root|host=127.0.0.1|port=${DDEV_HOST_DB_PORT}|name=${DDEV_SITENAME}\""
case $OSTYPE in
"win*"* | "msys"*)
'/c/Program Files/DBeaver/dbeaver.exe' "$arguments" &
;;
# linux-gnu in this case is only WSL2 as selected in OSTypes above
"linux-gnu")
# DBeaver is Microsoft only, but we want to start it from WSL2
'/mnt/c/Program Files/DBeaver/dbeaver-cli.exe' $arguments &
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment