From 41bfb68ee296a4ecdcbd9c02d242d6c9e149b7b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Aug 2016 15:23:00 -0400 Subject: make storage to use configurable on command line --- CmdLine.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index 6413cf7..93828bc 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -10,14 +10,17 @@ import qualified Gpg import Options.Applicative import qualified Data.ByteString.UTF8 as BU8 import System.Directory +import Storage +import Storage.Local +import Storage.Network data CmdLine = CmdLine { mode :: Maybe Mode , secretkeysource :: Maybe SecretKeySource - , testMode :: Bool + , storage :: Storage , gui :: Bool + , testMode :: Bool } - deriving (Show) data Mode = Backup | Restore | Benchmark deriving (Show) @@ -26,8 +29,9 @@ parse :: Parser CmdLine parse = CmdLine <$> optional (backup <|> restore <|> benchmark) <*> optional (gpgswitch <|> fileswitch) - <*> testmodeswitch + <*> localstorageflag <*> guiswitch + <*> testmodeswitch where backup = flag' Backup ( long "backup" @@ -49,6 +53,10 @@ parse = CmdLine ( 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.)" ) + localstorageflag = flag networkStorage localStorage + ( long "store-local" + <> help "Store data locally, in ~/.keysafe/objects. (The default is to store data in the cloud.)" + ) testmodeswitch = switch ( long "testmode" <> help "Avoid using expensive cryptographic operation to secure key. Use for testing only, not with real secret keys." -- cgit v1.2.3