Skip to content

Commit e9562a6

Browse files
giacomocavalierinicolasfara
authored andcommitted
fix: fix resolution of selector
1 parent deccc79 commit e9562a6

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/main/scala/dev/atedeg/Configuration.scala

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ final case class Selector(selector: String) {
1919
.filterOrElse(_.nonEmpty, s"No files found matching selector $selector")
2020
}
2121

22-
private def unsafeToFiles(workingDir: File): List[File] = {
23-
val dir = File(workingDir, selector)
24-
if (dir.isDirectory) dir.listHtmlFiles.toList
25-
else {
26-
workingDir.listHtmlFiles.find(_.nameWithoutExtension == selector) match {
27-
case Some(f) => List(f)
28-
case None => workingDir.globHtmlFiles(selector).toList
29-
}
22+
private def unsafeToFiles(workingDir: File): List[File] =
23+
htmlFilesInDirectory(File(workingDir, selector)) ++ selectorToFileOrGlob(workingDir)
24+
25+
private def selectorToFileOrGlob(workingDir: File): List[File] =
26+
workingDir.listHtmlFiles.find(_.nameWithoutExtension == selector) match {
27+
case Some(f) => List(f)
28+
case None => workingDir.globHtmlFiles(selector).toList
3029
}
31-
}
30+
31+
private def htmlFilesInDirectory(dir: File): List[File] =
32+
if (dir.isDirectory) dir.listHtmlFiles.toList else List()
3233
}
3334

3435
final case class Configuration(ignored: List[Selector], tables: List[TableConfig])

0 commit comments

Comments
 (0)