summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-07 00:58:51 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-07 00:58:51 -0400
commitd8394ede7b16d9aafcc19885f31d7935250a9bb6 (patch)
tree7615d95b51844b54cd37690206b045197f86c055 /Command
parent466a2c31be0f662c3c93dd54867d2a969e01714e (diff)
fromkey, registerurl: When reading from stdin, allow the filename and url, respectively, to contain whitespace.
Diffstat (limited to 'Command')
-rw-r--r--Command/FromKey.hs4
-rw-r--r--Command/RegisterUrl.hs4
2 files changed, 4 insertions, 4 deletions
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index 10484b840..ebc0e6f6e 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -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
diff --git a/Command/RegisterUrl.hs b/Command/RegisterUrl.hs
index 3ff1becc9..d0e806597 100644
--- a/Command/RegisterUrl.hs
+++ b/Command/RegisterUrl.hs
@@ -34,10 +34,10 @@ start [] = do
start _ = error "specify a key and an url"
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,u]:rest) = do
+ go status ((keyname,u):rest) | not (null keyname) && not (null u) = do
let key = fromMaybe (error $ "bad key " ++ keyname) $ file2key keyname
ok <- perform' key u
let !status' = status && ok