summaryrefslogtreecommitdiff
path: root/sqlparse/cli.py
diff options
context:
space:
mode:
authorJohannes Hoff <johshoff@gmail.com>2017-06-20 20:18:15 -0700
committerJohannes Hoff <johshoff@gmail.com>2017-06-20 20:18:15 -0700
commit7cdefe9aa751fa54831cc1e64fbf4b16acc6c90e (patch)
treefe73b9a2cc3c66f70b66c21ac4122c61958409e0 /sqlparse/cli.py
parentdc788ab5b1af2e2a4a988b31a09d8d6656853f76 (diff)
downloadsqlparse-7cdefe9aa751fa54831cc1e64fbf4b16acc6c90e.tar.gz
Option to indent after first line
This adds a command line argument `--indent_after_first` which sets the indentation of all lines after the first one, e.g. SELECT, UPDATE, etc. For example: $ sqlparse/__main__.py -r sample.sql UPDATE foo SET a = 1 WHERE a > 2 AND a < 10; $ sqlparse/__main__.py -r --indent_after_first sample.sql UPDATE foo SET a = 1 WHERE a > 2 AND a < 10;
Diffstat (limited to 'sqlparse/cli.py')
-rwxr-xr-xsqlparse/cli.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sqlparse/cli.py b/sqlparse/cli.py
index 0b5c204..0f66d90 100755
--- a/sqlparse/cli.py
+++ b/sqlparse/cli.py
@@ -102,6 +102,13 @@ def create_parser():
help='indentation width (defaults to 2 spaces)')
group.add_argument(
+ '--indent_after_first',
+ dest='indent_after_first',
+ action='store_true',
+ default=False,
+ help='indent after first line of statement (e.g. SELECT)')
+
+ group.add_argument(
'-a', '--reindent_aligned',
action='store_true',
default=False,