mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-06-16 10:34:34 +00:00
Implemented Allman braces
This commit is contained in:
1 parent
19a4a969e8
commit
cc180313d6
4 files changed
+160
-69
No files matched your search
@@ -38,6 +38,7 @@ let version = "0.14"
|
||||
let arguments = [
|
||||
"output",
|
||||
"indent",
|
||||
"allman",
|
||||
"linebreaks",
|
||||
"semicolons",
|
||||
"commas",
|
||||
@@ -45,6 +46,8 @@ let arguments = [
|
||||
"ranges",
|
||||
"empty",
|
||||
"trimwhitespace",
|
||||
"insertlines",
|
||||
"removelines",
|
||||
"experimental",
|
||||
"fragment",
|
||||
"help",
|
||||
@@ -60,6 +63,7 @@ func showHelp() {
|
||||
print(" <file> input file or directory path")
|
||||
print(" --output output path (defaults to input path)")
|
||||
print(" --indent number of spaces to indent, or \"tab\" to use tabs")
|
||||
print(" --allman use allman indentation style \"true\" or \"false\" (default)")
|
||||
print(" --linebreaks linebreak character to use. \"cr\", \"crlf\" or \"lf\" (default)")
|
||||
print(" --semicolons allow semicolons. \"never\" or \"inline\" (default)")
|
||||
print(" --commas commas in collection literals. \"always\" (default) or \"inline\"")
|
||||
@@ -114,6 +118,16 @@ func optionsForArguments(_ args: [String: String]) throws -> FormatOptions {
|
||||
throw NSError()
|
||||
}
|
||||
}
|
||||
try processOption("allman") {
|
||||
switch $0 {
|
||||
case "true", "enabled":
|
||||
options.allmanBraces = true
|
||||
case "false", "disabled":
|
||||
options.allmanBraces = false
|
||||
default:
|
||||
throw NSError()
|
||||
}
|
||||
}
|
||||
try processOption("semicolons") {
|
||||
switch $0 {
|
||||
case "inline":
|
||||
|
||||
Reference in new issue
Block a user