Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show help when no input is given #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saint1991
Copy link

@saint1991 saint1991 commented Mar 28, 2021

when no input is given, show help as follows,

$ sqlfmt
usage: sqlfmt [flags] [path ...]
  -d    display diffs instead of rewriting files
  -distance int
        write the distance from the edge to the begin of SQL statements
  -l    list files whose formatting differs from goreturns's
  -w    write result to (source) file instead of stdout

it also works fine when pipe input is given

$ cat sqlfmt/testdata/testing_gofile.go | sqlfmt
package sqlfmt

import (
        "database/sql"
)

func sendSQL() int {
        var id int
        var db *sql.DB
        db.QueryRow(`
SELECT
  any (
    SELECT
      xxx
    FROM xxx
  )
FROM xxx
WHERE xxx
LIMIT xxx`).Scan(&id)
        return id
}

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.

None yet

1 participant