-
Notifications
You must be signed in to change notification settings - Fork 59
/
narrow
executable file
·36 lines (33 loc) · 1.02 KB
/
narrow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/local/bin/env -S scala-cli shebang --quiet
// to narrow projs.conf to one project:
// % ./narrow scalacheck
// or several:
// % ./narrow scalacheck scalatest specs2
// to un-narrow, pass no arguments:
// % ./narrow
//> using scala 3.6.1
//> using option -deprecation -source:future
//> using dep com.lihaoyi::os-lib:0.11.2
val projs: Seq[String] =
if args.isEmpty then
os.list(os.pwd / "proj")
.filter(_.ext == "conf")
.map(_.baseName)
.toSeq
else
args.toSeq
val out = os.pwd / "projs.conf"
os.write.over(out,
"// automatically generated by `narrow` script\n\n")
for proj <- projs.toSeq.sorted do
os.write.append(out,
s"""|build += {
| space: scala.$proj
| check-missing: [false, false]
| cross-version: [disabled, standard]
| extraction-version: $${vars.scala-version}
| sbt-version: $${vars.sbt-version}
| sbt-java-options: $${vars.sbt-java-options}
| projects: [$${vars.proj.$proj}]
|}
|""".stripMargin)