cloudspannerecosystem / memefish

memefish is the foundation to analyze Spanner SQL
https://cloudspannerecosystem.dev/memefish/
MIT License
76 stars 19 forks source link

Execute tools/parse only when NArg == 1 #185

Closed apstndb closed 2 weeks ago

apstndb commented 2 weeks ago

I have repeatedly mistaken to use tools/parse because I have forgotten Go flag behavior. I think it is better to print usages when there are flags after positional parameter.

Current behavior

# -dig and -pos are ignored
$ go run ./tools/parse/main.go "SELECT 1 AS x" -dig "Query.Results.0" -pos "As.end"

Fixed behavior

$ go run ./tools/parse/main.go "SELECT 1 AS x" -dig "Query.Results.0" -pos "As.end"
Usage of tools/parse.go

A testing tool for parsing Spanner SQL.

Example:
...