mirror of https://github.com/sbt/sbt.git
Merge pull request #5014 from eatkins/fail-on-exception
Display only valid pages in scripted completions
This commit is contained in:
commit
19ead4144d
|
|
@ -136,8 +136,10 @@ object ScriptedPlugin extends AutoPlugin {
|
||||||
val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
|
val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
|
||||||
|
|
||||||
// A parser for page definitions
|
// A parser for page definitions
|
||||||
val pageP: Parser[ScriptedTestPage] = ("*" ~ NatBasic ~ "of" ~ NatBasic) map {
|
val pageNumber = NatBasic & not('0', "zero page number")
|
||||||
case _ ~ page ~ _ ~ total => ScriptedTestPage(page, total)
|
val pageP: Parser[ScriptedTestPage] = ("*" ~> pageNumber ~ ("of" ~> pageNumber)) flatMap {
|
||||||
|
case (page, total) if page <= total => success(ScriptedTestPage(page, total))
|
||||||
|
case (page, total) => failure(s"Page $page was greater than $total")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grabs the filenames from a given test group in the current page definition.
|
// Grabs the filenames from a given test group in the current page definition.
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,10 @@ object Scripted {
|
||||||
val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
|
val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
|
||||||
|
|
||||||
// A parser for page definitions
|
// A parser for page definitions
|
||||||
val pageP: Parser[ScriptedTestPage] = ("*" ~ NatBasic ~ "of" ~ NatBasic) map {
|
val pageNumber = NatBasic & not('0', "zero page number")
|
||||||
case _ ~ page ~ _ ~ total => ScriptedTestPage(page, total)
|
val pageP: Parser[ScriptedTestPage] = ("*" ~> pageNumber ~ ("of" ~> pageNumber)) flatMap {
|
||||||
|
case (page, total) if page <= total => success(ScriptedTestPage(page, total))
|
||||||
|
case (page, total) => failure(s"Page $page was greater than $total")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grabs the filenames from a given test group in the current page definition.
|
// Grabs the filenames from a given test group in the current page definition.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue