summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-04-22 19:43:18 -0400
committerjoe <joe@jerkface.net>2014-04-22 19:43:18 -0400
commit9eed726050691c1526410844a8954b5580386825 (patch)
tree3d14aa44273625f112876b23d0b334f9dd14993e
parentbdfc90edae040cefccbe1018f1506c445608e460 (diff)
Started porting kiki to a multi-mode interface.
-rw-r--r--kiki.hs34
1 files changed, 31 insertions, 3 deletions
diff --git a/kiki.hs b/kiki.hs
index 620d01e..0c1d4c6 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -521,9 +521,7 @@ doAutosign rt kd@(KeyData k ksigs umap submap) = ops
521 gs = groupBy sameMaster (sortBy (comparing code) bindings') 521 gs = groupBy sameMaster (sortBy (comparing code) bindings')
522 522
523 523
524main = do 524kiki "sync" args_raw = do
525 dotlock_init
526 args_raw <- getArgs
527 let (args,trail1) = break (=="--") args_raw 525 let (args,trail1) = break (=="--") args_raw
528 trail = drop 1 trail1 526 trail = drop 1 trail1
529 (sargs,margs) = 527 (sargs,margs) =
@@ -646,3 +644,33 @@ main = do
646 644
647 forM_ report $ \(fname,act) -> do 645 forM_ report $ \(fname,act) -> do
648 putStrLn $ fname ++ ": " ++ reportString act 646 putStrLn $ fname ++ ": " ++ reportString act
647
648kiki "working-key" args = do
649 kiki "sync" ["--show-wk"]
650
651kiki "help" args = do
652 putStrLn "Valid commands are:"
653 let longest = maximum $ map (length . fst) commands
654 pad cmd = take (longest+3) $ cmd ++ repeat ' '
655 forM commands $ \(cmd,help) -> do
656 putStrLn $ " " ++ pad cmd ++ help
657 return ()
658
659commands :: [(String,String)]
660commands =
661 [ ( "help", "display usage information" )
662 , ( "sync", "update key files of various kinds by propogating information" )
663 , ( "working-key", "show the current working master key and its subkeys" )
664 ]
665
666main = do
667 dotlock_init
668 args_raw <- getArgs
669 case args_raw of
670
671 [] -> kiki "working-key" []
672
673 cmd : args | cmd `elem` map fst commands
674 -> kiki cmd args
675
676 _ -> kiki "help" args_raw