summaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-15 22:46:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-15 22:46:47 -0400
commit9d24cc7bdb011d66e41229a3b96401808be47268 (patch)
tree91b602b962a1cee9095f5b3d63a01b9ebd160f20 /Command.hs
parent2e1cc2f8b98aaf9e01b620d557c42d5b1ae2aaa6 (diff)
make commands that take a key as a parameter error if it's bad
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Command.hs b/Command.hs
index c3cb612ee..41ad884a9 100644
--- a/Command.hs
+++ b/Command.hs
@@ -14,7 +14,6 @@ import Control.Monad (filterM, liftM, when)
import System.Path.WildMatch
import Text.Regex.PCRE.Light.Char8
import Data.List
-import Data.Maybe
import Types
import qualified Backend
@@ -171,7 +170,11 @@ withFilesUnlocked' typechanged a params = do
unlockedfiles' <- filterFiles unlockedfiles
backendPairs a unlockedfiles'
withKeys :: CommandSeekKeys
-withKeys a params = return $ map a $ catMaybes $ map readKey params
+withKeys a params = return $ map a $ map parse params
+ where
+ parse p = case readKey p of
+ Just k -> k
+ Nothing -> error "bad key"
withTempFile :: CommandSeekStrings
withTempFile a params = return $ map a params
withNothing :: CommandSeekNothing