fromkey, registerurl: When reading from stdin, allow the filename and url, respectively, to contain whitespace.

This commit is contained in:
Joey Hess 2015-04-07 00:58:51 -04:00
parent 42281f12d6
commit 279fa44cd0
5 changed files with 8 additions and 6 deletions

View file

@ -41,10 +41,10 @@ start _ [] = do
start _ _ = error "specify a key and a dest file"
massAdd :: CommandPerform
massAdd = go True =<< map words . lines <$> liftIO getContents
massAdd = go True =<< map (separate (== ' ')) . lines <$> liftIO getContents
where
go status [] = next $ return status
go status ([keyname,f]:rest) = do
go status ((keyname,f):rest) | not (null keyname) && not (null f) = do
let key = fromMaybe (error $ "bad key " ++ keyname) $ file2key keyname
ok <- perform' key f
let !status' = status && ok