From 9d24cc7bdb011d66e41229a3b96401808be47268 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Mar 2011 22:46:47 -0400 Subject: [PATCH] make commands that take a key as a parameter error if it's bad --- Command.hs | 7 +++++-- Command/DropKey.hs | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Command.hs b/Command.hs index c3cb612ee0..41ad884a93 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 diff --git a/Command/DropKey.hs b/Command/DropKey.hs index 419d9caa43..b3cc60961c 100644 --- a/Command/DropKey.hs +++ b/Command/DropKey.hs @@ -9,12 +9,10 @@ module Command.DropKey where import Command import qualified Annex -import qualified Backend import LocationLog import Types import Content import Messages -import Key command :: [Command] command = [Command "dropkey" (paramRepeating paramKey) seek