From a956054ce82e2b0ca9f46b6d34288c73c25df0c9 Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 25 Aug 2016 19:31:23 -0400 Subject: Debug --dump option. --- kiki.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'kiki.hs') diff --git a/kiki.hs b/kiki.hs index 854bf23..0dedc03 100644 --- a/kiki.hs +++ b/kiki.hs @@ -288,6 +288,14 @@ show_wk secring_file grip db = do Message sec = flattenKeys False sec_db putStrLn $ listKeysFiltered (maybeToList grip) sec +debug_dump secring_file grip db = do + let sec_db = Map.filter gripmatch db + gripmatch (KeyData p _ _ _) = + Map.member secring_file (locations p) + || Map.member "&secret" (locations p) + Message sec = flattenKeys False sec_db + mapM_ print sec + show_all db = do let Message packets = flattenKeys True db putStrLn $ listKeys packets @@ -531,6 +539,8 @@ kiki_usage bExport bImport bSecret cmd = putStr $ ," Outputs tor address and base32 hash of the PEM-format key in" ," the given file." ,"" + ," --dump For debugging, a thorough info dump of your secret keyring." + ,"" ," --help Shows this help screen." ,"" ] @@ -1189,6 +1199,7 @@ kiki "show" [] = kiki "show" ["--working"] kiki "show" args = do let (sargs,margs) = processArgs sargspec polyVariadicArgs "--show" args sargspec = [ ("--working",0) --("--show-wk",0) + , ("--dump",0) --("--show-all",0) , ("--all",0) --("--show-all",0) , ("--whose-key",0) , ("--key",1) @@ -1249,6 +1260,7 @@ kiki "show" args = do ,("--wip",\[x] -> show_wip x $ fromMaybe "" grip) ,("--cert",\[x] -> show_cert x $ fromMaybe "" grip) ,("--torhash",\[x] -> show_torhash x) + ,("--dump", const $ debug_dump (rtSecring rt) grip) ] shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs -- cgit v1.2.3