summaryrefslogtreecommitdiffhomepage
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-16 13:40:52 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-16 13:40:52 -0400
commitc9c476ae7216b80932b80870a2cd06f9339306aa (patch)
treead2255c1d331bb2f286d7786e65151ba987a8247 /CmdLine.hs
parent3229b02f0aa6bb23e351d00ade1263851a2f1826 (diff)
downloadkeysafe-c9c476ae7216b80932b80870a2cd06f9339306aa.tar.gz
improve options to select secret key to backup/restore
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 8e3040a..ca574bb 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -11,7 +11,7 @@ import qualified Data.ByteString.UTF8 as BU8
data CmdLine = CmdLine
{ mode :: Mode
- , keytype :: KeyType
+ , secretkeysource :: Maybe SecretKeySource
, testMode :: Bool
, gui :: Bool
}
@@ -23,7 +23,7 @@ data Mode = Backup | Restore | Benchmark
parse :: Parser CmdLine
parse = CmdLine
<$> (backup <|> restore <|> benchmark)
- <*> keytypeopt
+ <*> optional (gpgswitch <|> fileswitch)
<*> testmodeswitch
<*> guiswitch
where
@@ -39,9 +39,13 @@ parse = CmdLine
( long "benchmark"
<> help "Benchmark speed of keysafe's cryptographic primitives."
)
- keytypeopt = KeyType . BU8.fromString <$> strOption
- ( long "type"
- <> help "Type of key (eg, \"gpg\")."
+ gpgswitch = GpgKey . KeyId . BU8.fromString <$> strOption
+ ( long "gpgkeyid"
+ <> help "Specify keyid of gpg key to back up or restore."
+ )
+ fileswitch = KeyFile <$> strOption
+ ( long "keyfile"
+ <> help "Specify secret key file to back up or restore. (The same filename must be used to restore a key as was used to back it up.)"
)
testmodeswitch = switch
( long "testmode"