summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--KeyRing.hs18
-rw-r--r--kiki.hs6
2 files changed, 21 insertions, 3 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 78fb40c..532acb8 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -10,6 +10,8 @@ module KeyRing
10 , KikiResult(..) 10 , KikiResult(..)
11 , KikiCondition(..) 11 , KikiCondition(..)
12 , KikiReportAction(..) 12 , KikiReportAction(..)
13 , errorString
14 , reportString
13 , KeyRingRuntime(..) 15 , KeyRingRuntime(..)
14 , InputFile(..) 16 , InputFile(..)
15 , FileType(..) 17 , FileType(..)
@@ -394,6 +396,22 @@ data KikiReportAction =
394 | HostsDiff ByteString 396 | HostsDiff ByteString
395 deriving Show 397 deriving Show
396 398
399uncamel :: String -> String
400uncamel str = unwords $ firstWord ++ (toLower .: otherWords) ++ args
401 where
402 (.:) = fmap . fmap
403 ( firstWord ,
404 otherWords ) = splitAt 1 ws
405 ws = camel >>= groupBy (\_ c -> isLower c)
406 ( camel, args) = splitAt 1 $ words str
407
408reportString :: KikiReportAction -> String
409reportString x = uncamel $ show x
410
411errorString :: KikiCondition a -> String
412errorString (KikiSuccess {}) = "success"
413errorString e = uncamel . show $ fmap (const ()) e
414
397data KikiResult a = KikiResult 415data KikiResult a = KikiResult
398 { kikiCondition :: KikiCondition a 416 { kikiCondition :: KikiCondition a
399 , kikiReport :: [ (FilePath, KikiReportAction) ] 417 , kikiReport :: [ (FilePath, KikiReportAction) ]
diff --git a/kiki.hs b/kiki.hs
index cf3b453..9bfbd2d 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -750,10 +750,10 @@ main = do
750 shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs 750 shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs
751 751
752 forM_ shargs $ \(cmd,args) -> cmd args (rtKeyDB rt) 752 forM_ shargs $ \(cmd,args) -> cmd args (rtKeyDB rt)
753 e -> print (void e)--(fmap (const ()) e) 753 e -> putStrLn $ errorString e
754 754
755 print report 755 forM_ report $ \(fname,act) -> do
756 return() 756 putStrLn $ fname ++ ": " ++ reportString act
757 where 757 where
758 758
759 doAutosign rt kd@(KeyData k ksigs umap submap) = ops 759 doAutosign rt kd@(KeyData k ksigs umap submap) = ops