show an error message if garbage is provided to dropunused
This commit is contained in:
parent
13cfe5c582
commit
a1b6d2e057
1 changed files with 3 additions and 2 deletions
|
@ -62,11 +62,12 @@ withUnusedMaps a params = do
|
||||||
unusedSpec :: String -> [Int]
|
unusedSpec :: String -> [Int]
|
||||||
unusedSpec spec
|
unusedSpec spec
|
||||||
| "-" `isInfixOf` spec = range $ separate (== '-') spec
|
| "-" `isInfixOf` spec = range $ separate (== '-') spec
|
||||||
| otherwise = catMaybes [readish spec]
|
| otherwise = maybe badspec (: []) (readish spec)
|
||||||
where
|
where
|
||||||
range (a, b) = case (readish a, readish b) of
|
range (a, b) = case (readish a, readish b) of
|
||||||
(Just x, Just y) -> [x..y]
|
(Just x, Just y) -> [x..y]
|
||||||
_ -> []
|
_ -> badspec
|
||||||
|
badspec = error $ "Expected number or range, not \"" ++ spec ++ "\""
|
||||||
|
|
||||||
{- Start action for unused content. Finds the number in the maps, and
|
{- Start action for unused content. Finds the number in the maps, and
|
||||||
- calls either of 3 actions, depending on the type of unused file. -}
|
- calls either of 3 actions, depending on the type of unused file. -}
|
||||||
|
|
Loading…
Reference in a new issue