Skip to content

Commit

Permalink
sql format function
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsEckart committed Mar 30, 2022
1 parent 6b79d1e commit a7d89d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .functions
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ howManyJava(){
gw -q javaToolChains
}

# https://sqlformat.org/api/
sqlformat(){
curl -s --location --request POST 'https://sqlformat.org/api/v1/format' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'reindent=1' \
--data-urlencode 'indent_width=3' \
--data-urlencode 'keyword_case=upper' \
--data-urlencode 'strip_comments=1' \
--data-urlencode "sql=$1" | jq -r '.result'

}

#
# The bumbailiff allows the team to take up a small amount of technical debt
# (TODOs in the code) for a limited period. After that period the script fails.
Expand Down

0 comments on commit a7d89d7

Please sign in to comment.