make commands that take a key as a parameter error if it's bad
This commit is contained in:
parent
2e1cc2f8b9
commit
9d24cc7bdb
2 changed files with 5 additions and 4 deletions
|
@ -14,7 +14,6 @@ import Control.Monad (filterM, liftM, when)
|
||||||
import System.Path.WildMatch
|
import System.Path.WildMatch
|
||||||
import Text.Regex.PCRE.Light.Char8
|
import Text.Regex.PCRE.Light.Char8
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import qualified Backend
|
import qualified Backend
|
||||||
|
@ -171,7 +170,11 @@ withFilesUnlocked' typechanged a params = do
|
||||||
unlockedfiles' <- filterFiles unlockedfiles
|
unlockedfiles' <- filterFiles unlockedfiles
|
||||||
backendPairs a unlockedfiles'
|
backendPairs a unlockedfiles'
|
||||||
withKeys :: CommandSeekKeys
|
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 :: CommandSeekStrings
|
||||||
withTempFile a params = return $ map a params
|
withTempFile a params = return $ map a params
|
||||||
withNothing :: CommandSeekNothing
|
withNothing :: CommandSeekNothing
|
||||||
|
|
|
@ -9,12 +9,10 @@ module Command.DropKey where
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import qualified Backend
|
|
||||||
import LocationLog
|
import LocationLog
|
||||||
import Types
|
import Types
|
||||||
import Content
|
import Content
|
||||||
import Messages
|
import Messages
|
||||||
import Key
|
|
||||||
|
|
||||||
command :: [Command]
|
command :: [Command]
|
||||||
command = [Command "dropkey" (paramRepeating paramKey) seek
|
command = [Command "dropkey" (paramRepeating paramKey) seek
|
||||||
|
|
Loading…
Reference in a new issue