diff --git a/main.go b/main.go index b522137..ab16dd0 100644 --- a/main.go +++ b/main.go @@ -22,15 +22,15 @@ type database struct { func main() { databases := mustReadDatabasesConfigFile() + if len(os.Args[1:]) == 0 { + usage("Target database unspecified; where should I run the query?") + } + sql := readInput(os.Stdin) if len(sql) <= 3 { usage("No SQL to run. Exiting.") } - if len(os.Args[1:]) == 0 { - usage("Target database unspecified; where should I run the query?") - } - targetDatabases := []string{} for _, k := range os.Args[1:] { if _, ok := databases[k]; k != "all" && !ok { diff --git a/usage.go b/usage.go index 81219cf..8e58b17 100644 --- a/usage.go +++ b/usage.go @@ -25,7 +25,7 @@ e.g. echo "SELECT * FROM users WHERE name = 'John'" | sql all -For more detailed help, please go to: https://github.com/MarianoGappa/sql +For more detailed help, please go to: https://github.com/marianogappa/sql `) os.Exit(1) }