summaryrefslogtreecommitdiff
path: root/kiki.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-07-05 22:40:47 -0400
committerJoe Crayne <joe@jerkface.net>2019-07-05 22:40:47 -0400
commitb6ea6fcee16c3ef65adff62d532346a3dee1f4fa (patch)
tree587fff9479bccb4828a928c75722723aa7c895e5 /kiki.hs
parent2283513fdd96122f9d72a8f7e4d8d2b4ed7919b4 (diff)
Tweaked merge command. Default --flow=spill, new option --packets.
Diffstat (limited to 'kiki.hs')
-rw-r--r--kiki.hs24
1 files changed, 18 insertions, 6 deletions
diff --git a/kiki.hs b/kiki.hs
index eb043f8..11f9fb4 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -1286,7 +1286,11 @@ kiki "show" args = do
1286 1286
1287kiki "merge" [] = do 1287kiki "merge" [] = do
1288 putStr . unlines $ 1288 putStr . unlines $
1289 [ "kiki merge [ ( --passphrase-fd=FD | --agent | --show-key=SPEC | --show-all ) ... ]" 1289 [ "kiki merge [ ( --passphrase-fd=FD"
1290 , " | --agent"
1291 , " | --show-key=SPEC"
1292 , " | --show-all"
1293 , " | --packets ) ... ]"
1290 , " ( --home[=HOMEDIR]" 1294 , " ( --home[=HOMEDIR]"
1291 , " | --type=(keyring|pem|wallet|hosts|dns)" 1295 , " | --type=(keyring|pem|wallet|hosts|dns)"
1292 , " | --access=[auto|secret|public]" 1296 , " | --access=[auto|secret|public]"
@@ -1312,6 +1316,8 @@ kiki "merge" [] = do
1312 , " --show-key=SPEC After files have been written, show information for the" 1316 , " --show-key=SPEC After files have been written, show information for the"
1313 , " key identified by SPEC." 1317 , " key identified by SPEC."
1314 , "" 1318 , ""
1319 , " --packets After files have been written, declare each known pkg packet."
1320 , ""
1315 , " FILE A path to a key file to read or update." 1321 , " FILE A path to a key file to read or update."
1316 , "" 1322 , ""
1317 , "MODIFIERS" 1323 , "MODIFIERS"
@@ -1325,6 +1331,8 @@ kiki "merge" [] = do
1325 , " --access=[auto|secret|public]" 1331 , " --access=[auto|secret|public]"
1326 , "" 1332 , ""
1327 , " --flow=(fill|spill|sync)[,(subkeys|signed|match=SPEC)]" 1333 , " --flow=(fill|spill|sync)[,(subkeys|signed|match=SPEC)]"
1334 , " If not specified, default is to spill (read and use but"
1335 , " don't write)."
1328 , "" 1336 , ""
1329 , " --create=(rsa:SIZE|cmd:CMD)" 1337 , " --create=(rsa:SIZE|cmd:CMD)"
1330 , "" 1338 , ""
@@ -1346,18 +1354,22 @@ kiki "merge" args = do
1346 then show_all db 1354 then show_all db
1347 else forM_ keyspecs $ \keyspec -> do 1355 else forM_ keyspecs $ \keyspec -> do
1348 show_id keyspec (error "show_id wkgrip") db 1356 show_id keyspec (error "show_id wkgrip") db
1357 when bPackets $ show_packets [] db
1349 err -> putStrLn $ errorString err 1358 err -> putStrLn $ errorString err
1350 forM_ report $ \(fname,act) -> do 1359 forM_ report $ \(fname,act) -> do
1351 putStrLn $ fname ++ ": " ++ reportString act 1360 putStrLn $ fname ++ ": " ++ reportString act
1352 where 1361 where
1353 (_,((_,keyspecs),op)) = foldl' buildOp (True,((flow0,[]),noop)) args'' 1362 (_,((_,keyspecs),op)) = foldl' buildOp (True,((flow0,[]),noop)) args3
1354 (args',mbAgent) = case break (=="--agent") args of 1363 (args',mbAgent) = case break (=="--agent") args of
1355 (as,[]) -> (args, id) 1364 (as,[]) -> (as, id)
1356 (as,_:bs) -> ( as++bs 1365 (as,_:bs) -> ( as++bs
1357 , \op -> op { opPassphrases = withAgent (opPassphrases op) }) 1366 , \op -> op { opPassphrases = withAgent (opPassphrases op) })
1358 (args'',bShowAll) = case break (=="--show-all") args' of 1367 (args'',bShowAll) = case break (=="--show-all") args' of
1359 (as,[]) -> (args, False) 1368 (as,[]) -> (as, False)
1360 (as,_:bs) -> ( as++bs, True) 1369 (as,_:bs) -> (as++bs, True)
1370 (args3,bPackets) = case break (=="--packets") args'' of
1371 (as,[]) -> (as, False)
1372 (as,_:bs) -> (as++bs, True)
1361 noop = KeyRingOperation 1373 noop = KeyRingOperation
1362 { opFiles = Map.empty 1374 { opFiles = Map.empty
1363 , opTransforms = [] 1375 , opTransforms = []
@@ -1367,7 +1379,7 @@ kiki "merge" args = do
1367 flow0 = StreamInfo 1379 flow0 = StreamInfo
1368 { access = AutoAccess 1380 { access = AutoAccess
1369 , typ = KeyRingFile 1381 , typ = KeyRingFile
1370 , spill = KF_None 1382 , spill = KF_All
1371 , fill = KF_None 1383 , fill = KF_None
1372 , initializer = NoCreate 1384 , initializer = NoCreate
1373 , transforms = [] 1385 , transforms = []