mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-22 23:19:25 -04:00
Implement setting tabs and spaces for indents
This commit is contained in:
parent
afba576da0
commit
bf3917099a
2 changed files with 24 additions and 6 deletions
|
@ -74,8 +74,23 @@ class BlueprintApp:
|
|||
"-f",
|
||||
"--fix",
|
||||
help="Format the files in place, don't output the diff",
|
||||
default=False,
|
||||
action="store_true",
|
||||
)
|
||||
format.add_argument(
|
||||
"-t",
|
||||
"--tabs",
|
||||
help="Use tabs instead of spaces",
|
||||
default=False,
|
||||
action="store_true",
|
||||
)
|
||||
format.add_argument(
|
||||
"-s",
|
||||
"--spaces",
|
||||
help="How many spaces should be used per indent",
|
||||
default=2,
|
||||
type=int,
|
||||
)
|
||||
format.add_argument(
|
||||
"inputs",
|
||||
nargs="+",
|
||||
|
@ -193,7 +208,7 @@ class BlueprintApp:
|
|||
for warning in warnings:
|
||||
warning.pretty_print(file.name, data, stream=sys.stderr)
|
||||
|
||||
formatted_str = Format.format(data)
|
||||
formatted_str = Format.format(data, opts.spaces, not opts.tabs)
|
||||
|
||||
if data != formatted_str:
|
||||
happened = "Would reformat"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue