-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
620bd21
commit 8756a65
Showing
2 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,16 +34,17 @@ func BuildMysqlCommand() *cobra.Command { | |
dbPassword := "" | ||
|
||
var mysqlCommand = &cobra.Command{ | ||
Use: "mysql [cli|mycli|sequelace|beekeeper] (extra-params)", | ||
Use: "mysql [usql|cli|mycli|sequelace|beekeeper] (extra-params)", | ||
DisableFlagsInUseLine: true, | ||
ValidArgs: []string{"cli", "mycli", "sequelace", "beekeeper"}, | ||
ValidArgs: []string{"usql", "cli", "mycli", "sequelace", "beekeeper"}, | ||
Args: cobra.MinimumNArgs(1), | ||
Short: "Build a mysql connection and enter it via one of the given tools", | ||
Long: ` | ||
drop into a MySQL CLI to the given target | ||
drop into a MySQL CLI to the given target. | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
allowedArgs := map[string]bool{ | ||
"usql": true, | ||
"cli": true, | ||
"mycli": true, | ||
"sequelace": true, | ||
|
@@ -68,6 +69,18 @@ drop into a MySQL CLI to the given target | |
defer db.Close() | ||
|
||
switch args[0] { | ||
case "usql": | ||
usql := exec.Command( | ||
"usql", | ||
fmt.Sprintf("mysql://%s:%[email protected]:%d/%s", dbUser, dbPassword, localDbProxyPort, dbName), | ||
) | ||
usql.Stdout = os.Stdout | ||
usql.Stderr = os.Stderr | ||
usql.Stdin = os.Stdin | ||
|
||
usql.Run() | ||
|
||
break | ||
case "cli": | ||
mysqlArgs := []string{ | ||
"--host=127.0.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,16 +34,17 @@ func BuildPostgresCommand() *cobra.Command { | |
dbPassword := "" | ||
|
||
var postgresCommand = &cobra.Command{ | ||
Use: "postgres [cli|pgcli|beekeeper] (extra-params)", | ||
Use: "postgres [usql|cli|pgcli|beekeeper] (extra-params)", | ||
DisableFlagsInUseLine: true, | ||
ValidArgs: []string{"cli", "pgcli", "beekeeper"}, | ||
ValidArgs: []string{"usql", "cli", "pgcli", "beekeeper"}, | ||
Args: cobra.MinimumNArgs(1), | ||
Short: "Build a postgres connection and enter it via one of the given tools", | ||
Long: ` | ||
drop into a MySQL CLI to the given target | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
allowedArgs := map[string]bool{ | ||
"usql": true, | ||
"cli": true, | ||
"pgcli": true, | ||
"beekeeper": true, | ||
|
@@ -67,6 +68,18 @@ drop into a MySQL CLI to the given target | |
defer db.Close() | ||
|
||
switch args[0] { | ||
case "usql": | ||
usql := exec.Command( | ||
"usql", | ||
fmt.Sprintf("postgres://%s:%[email protected]:%d/%s", dbUser, dbPassword, localDbProxyPort, dbName), | ||
) | ||
usql.Stdout = os.Stdout | ||
usql.Stderr = os.Stderr | ||
usql.Stdin = os.Stdin | ||
|
||
usql.Run() | ||
|
||
break | ||
case "cli": | ||
psqlArgs := []string{ | ||
"--host=127.0.0.1", | ||
|