@@ -12,20 +12,20 @@ object CliArgParser {
12
12
13
13
val usageExamples : String =
14
14
""" |scalafmt # Format all files in the current project, configuration is determined in this order:
15
- | # 1. .scalafmt.conf file in current directory
16
- | # 2. .scalafmt.conf inside root directory of current git repo
17
- | # 3. no configuration, default style
18
- |scalafmt --test # throw exception on mis-formatted files, won't write to files.
19
- |scalafmt --mode diff # Format all files that were edited in git diff against master branch.
20
- |scalafmt --mode changed # Format files listed in `git status` (latest changes against previous commit.
21
- |scalafmt --diff-branch 2.x # same as --diff, except against branch 2.x
22
- |scalafmt --stdin # read from stdin (doesn't imply --stdout)
23
- |scalafmt --stdin --assume-filename foo.sbt < foo.sbt # required when using --stdin to format .sbt files.
24
- |scalafmt Code1.scala A.scala # write formatted contents to file.
25
- |scalafmt --stdout Code.scala # print formatted contents to stdout.
26
- |scalafmt --exclude target # format all files in directory excluding target
27
- |scalafmt --config .scalafmt.conf # read custom style from file.
28
- |scalafmt --config-str "style=IntelliJ" # define custom style as a flag, must be quoted."""
15
+ | # 1. .scalafmt.conf file in current directory
16
+ | # 2. .scalafmt.conf inside root directory of current git repo
17
+ | # 3. no configuration, default style
18
+ |scalafmt --test # throw exception on mis-formatted files, won't write to files.
19
+ |scalafmt --mode diff # Format all files that were edited in git diff against master branch.
20
+ |scalafmt --mode changed # Format files listed in `git status` (latest changes against previous commit.
21
+ |scalafmt --diff-branch 2.x # same as --diff, except against branch 2.x
22
+ |scalafmt --stdin # read from stdin (doesn't imply --stdout)
23
+ |scalafmt --stdin --assume-filename foo.sbt < foo.sbt # required when using --stdin to format .sbt files.
24
+ |scalafmt Code1.scala A.scala # write formatted contents to file.
25
+ |scalafmt --stdout Code.scala # print formatted contents to stdout.
26
+ |scalafmt --exclude target # format all files in directory excluding target
27
+ |scalafmt --config .scalafmt.conf # read custom style from file.
28
+ |scalafmt --config-str "style=IntelliJ" # define custom style as a flag, must be quoted."""
29
29
.stripMargin
30
30
31
31
val scoptParser : OptionParser [CliOptions ] =
@@ -53,9 +53,9 @@ object CliArgParser {
53
53
arg[Path ](" <file>..." ).optional().unbounded().action((file, c) =>
54
54
c.addFile(file)
55
55
).text(
56
- """ file, or directory (in which all *.scala files are to be formatted);
57
- |if starts with '@', refers to path listing files to be formatted
58
- |(with "@-" referring to standard input as a special case)"""
56
+ """ | file, or directory (in which all *.scala files are to be formatted);
57
+ |if starts with '@', refers to path listing files to be formatted
58
+ |(with "@-" referring to standard input as a special case)"""
59
59
.stripMargin
60
60
)
61
61
@@ -99,20 +99,20 @@ object CliArgParser {
99
99
writeMode(c, WriteMode .Test ).copy(error = true , check = true )
100
100
).text(" test for mis-formatted code only, exits with status 1 on first failure." )
101
101
opt[FileFetchMode ](" mode" ).action((m, c) => c.copy(mode = Option (m))).text(
102
- s """ Sets the files to be formatted fetching mode.
103
- |Options:
104
- | ${FileFetchMode .help}
105
- | """ .stripMargin
102
+ s """ | Sets the files to be formatted fetching mode.
103
+ |Options:
104
+ | ${FileFetchMode .help}
105
+ | """ .stripMargin
106
106
)
107
107
opt[Unit ](" diff" )
108
108
.action((_, c) => c.copy(mode = Option (DiffFiles (" master" )))).text(
109
- s """ Format files listed in `git diff` against master.
110
- |Deprecated: use --mode diff instead """ .stripMargin
109
+ s """ | Format files listed in `git diff` against master.
110
+ |Deprecated: use --mode diff instead """ .stripMargin
111
111
)
112
112
opt[String ](" diff-branch" )
113
113
.action((branch, c) => c.copy(mode = Option (DiffFiles (branch)))).text(
114
- s """ Format files listed in `git diff` against given git ref.
115
- |Deprecated: use --mode diff-ref=<ref> instead """ .stripMargin
114
+ s """ | Format files listed in `git diff` against given git ref.
115
+ |Deprecated: use --mode diff-ref=<ref> instead """ .stripMargin
116
116
)
117
117
opt[Unit ](" build-info" ).action((_, _) => { println(buildInfo); sys.exit })
118
118
.text(" prints build information" )
@@ -132,9 +132,9 @@ object CliArgParser {
132
132
133
133
note(
134
134
s """ |Examples:
135
- | $usageExamples
136
- |Please file bugs to https://github.com/scalameta/scalafmt/issues
137
- """ .stripMargin
135
+ | $usageExamples
136
+ |Please file bugs to https://github.com/scalameta/scalafmt/issues
137
+ | """ .stripMargin
138
138
)
139
139
140
140
checkConfig { c =>
@@ -143,8 +143,9 @@ object CliArgParser {
143
143
else success
144
144
}
145
145
}
146
- def buildInfo = s """ build commit: ${Versions .commit}
147
- |build time: ${new Date (Versions .timestamp.toLong)}""" .stripMargin
146
+ def buildInfo =
147
+ s """ |build commit: ${Versions .commit}
148
+ |build time: ${new Date (Versions .timestamp.toLong)}""" .stripMargin
148
149
149
150
private def writeMode (c : CliOptions , writeMode : WriteMode ): CliOptions = c
150
151
.writeModeOpt.fold { c.copy(writeModeOpt = Some (writeMode)) } { x =>
0 commit comments