diff options
author | joe <joe@jerkface.net> | 2014-04-22 19:43:18 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-04-22 19:43:18 -0400 |
commit | 9eed726050691c1526410844a8954b5580386825 (patch) | |
tree | 3d14aa44273625f112876b23d0b334f9dd14993e | |
parent | bdfc90edae040cefccbe1018f1506c445608e460 (diff) |
Started porting kiki to a multi-mode interface.
-rw-r--r-- | kiki.hs | 34 |
1 files changed, 31 insertions, 3 deletions
@@ -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 | ||
524 | main = do | 524 | kiki "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 | |||
648 | kiki "working-key" args = do | ||
649 | kiki "sync" ["--show-wk"] | ||
650 | |||
651 | kiki "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 | |||
659 | commands :: [(String,String)] | ||
660 | commands = | ||
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 | |||
666 | main = 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 | ||