Skip to content

feat(cli): add flock open and flock db - #147

Open
beganovich wants to merge 3 commits into
flock-php:mainfrom
beganovich:feat/issue-137-open-and-db
Open

beganovich wants to merge 3 commits into
flock-php:mainfrom
beganovich:feat/issue-137-open-and-db

Conversation

@beganovich

Copy link
Copy Markdown

Fixes #137

What and why

From discussion #120: Herd's herd open and herd db. Flock only had flock worktree open (worktrees only) and no database command.

  • flock open [site|dir] — opens a site in the browser: the current one, by name, or by directory. Uses the URL the daemon serves, or the site's own when the daemon is stopped.
  • flock db [site|dir] — opens the database its .env names (PostgreSQL, MySQL, MariaDB, SQLite, MongoDB) in the client registered for postgres:///mysql:// links, else an installed TablePlus, TablePro, DataGrip or DBeaver. --url prints driver, host, database, user and URL instead.
  • The password only reaches the client; everything printed is masked.
  • Only these two commands accept a directory, so a path can't change another command's target.

How I tested it

Both commands against a throwaway FLOCK_HOME: open by directory, db --url for PostgreSQL and SQLite, --client with and without %s, and the error paths (unknown site, no .env, unknown driver). Unit tests cover the driver URLs, masking, the client splitter and site/directory resolution. go test -race, go vet, gofmt and builds for linux/darwin/windows are clean.

Not tested on macOS or Windows.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

herd open and herd database commands

1 participant