diff options
author | joe <joe@jerkface.net> | 2016-08-25 19:31:23 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2016-08-25 19:31:23 -0400 |
commit | a956054ce82e2b0ca9f46b6d34288c73c25df0c9 (patch) | |
tree | 4f6b378c09ae8a66ca09ef9fd21794e49d657dab | |
parent | 8925f9cdf05f27a905da20687c3141c90dc09c8d (diff) |
Debug --dump option.
-rw-r--r-- | kiki.hs | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -288,6 +288,14 @@ show_wk secring_file grip db = do | |||
288 | Message sec = flattenKeys False sec_db | 288 | Message sec = flattenKeys False sec_db |
289 | putStrLn $ listKeysFiltered (maybeToList grip) sec | 289 | putStrLn $ listKeysFiltered (maybeToList grip) sec |
290 | 290 | ||
291 | debug_dump secring_file grip db = do | ||
292 | let sec_db = Map.filter gripmatch db | ||
293 | gripmatch (KeyData p _ _ _) = | ||
294 | Map.member secring_file (locations p) | ||
295 | || Map.member "&secret" (locations p) | ||
296 | Message sec = flattenKeys False sec_db | ||
297 | mapM_ print sec | ||
298 | |||
291 | show_all db = do | 299 | show_all db = do |
292 | let Message packets = flattenKeys True db | 300 | let Message packets = flattenKeys True db |
293 | putStrLn $ listKeys packets | 301 | putStrLn $ listKeys packets |
@@ -531,6 +539,8 @@ kiki_usage bExport bImport bSecret cmd = putStr $ | |||
531 | ," Outputs tor address and base32 hash of the PEM-format key in" | 539 | ," Outputs tor address and base32 hash of the PEM-format key in" |
532 | ," the given file." | 540 | ," the given file." |
533 | ,"" | 541 | ,"" |
542 | ," --dump For debugging, a thorough info dump of your secret keyring." | ||
543 | ,"" | ||
534 | ," --help Shows this help screen." | 544 | ," --help Shows this help screen." |
535 | ,"" | 545 | ,"" |
536 | ] | 546 | ] |
@@ -1189,6 +1199,7 @@ kiki "show" [] = kiki "show" ["--working"] | |||
1189 | kiki "show" args = do | 1199 | kiki "show" args = do |
1190 | let (sargs,margs) = processArgs sargspec polyVariadicArgs "--show" args | 1200 | let (sargs,margs) = processArgs sargspec polyVariadicArgs "--show" args |
1191 | sargspec = [ ("--working",0) --("--show-wk",0) | 1201 | sargspec = [ ("--working",0) --("--show-wk",0) |
1202 | , ("--dump",0) --("--show-all",0) | ||
1192 | , ("--all",0) --("--show-all",0) | 1203 | , ("--all",0) --("--show-all",0) |
1193 | , ("--whose-key",0) | 1204 | , ("--whose-key",0) |
1194 | , ("--key",1) | 1205 | , ("--key",1) |
@@ -1249,6 +1260,7 @@ kiki "show" args = do | |||
1249 | ,("--wip",\[x] -> show_wip x $ fromMaybe "" grip) | 1260 | ,("--wip",\[x] -> show_wip x $ fromMaybe "" grip) |
1250 | ,("--cert",\[x] -> show_cert x $ fromMaybe "" grip) | 1261 | ,("--cert",\[x] -> show_cert x $ fromMaybe "" grip) |
1251 | ,("--torhash",\[x] -> show_torhash x) | 1262 | ,("--torhash",\[x] -> show_torhash x) |
1263 | ,("--dump", const $ debug_dump (rtSecring rt) grip) | ||
1252 | ] | 1264 | ] |
1253 | shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs | 1265 | shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs |
1254 | 1266 | ||