From c7dba730abf38e31d38dec1028d9844e0724e707 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Sep 2016 12:30:39 -0400 Subject: Added --name and --othername options. --- CmdLine.hs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index 05ba7da..c3b8256 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -23,6 +23,8 @@ data CmdLine = CmdLine , testMode :: Bool , customShareParams :: Maybe ShareParams , serverConfig :: ServerConfig + , name :: Maybe Name + , othername :: Maybe Name } data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test @@ -38,11 +40,13 @@ parse = CmdLine <$> optional (backup <|> restore <|> uploadqueued <|> server <|> benchmark <|> test) <*> optional (gpgswitch <|> fileswitch) <*> localstorageswitch - <*> localstoragedirectory + <*> localstoragedirectoryopt <*> guiswitch <*> testmodeswitch <*> optional (ShareParams <$> totalobjects <*> neededobjects) <*> serverconfig + <*> nameopt + <*> othernameopt where backup = flag' Backup ( long "backup" @@ -82,7 +86,7 @@ parse = CmdLine ( long "store-local" <> help "Store data locally. (The default is to store data in the cloud.)" ) - localstoragedirectory = optional $ LocalStorageDirectory <$> option str + localstoragedirectoryopt = optional $ LocalStorageDirectory <$> option str ( long "store-directory" <> metavar "DIR" <> help "Where to store data locally. (default: ~/.keysafe/objects/)" @@ -120,6 +124,17 @@ parse = CmdLine <> showDefault <> help "Address for server to bind to. (Use \"*\" to bind to all addresses.)" ) + nameopt = optional $ Name . BU8.fromString <$> strOption + ( long "name" + <> metavar "N" + <> help "Specify name used for key backup/restore, avoiding the usual prompt." + ) + othernameopt = optional $ Name . BU8.fromString <$> strOption + ( long "othername" + <> metavar "N" + <> help "Specify other name used for key backup/restore, avoiding the usual prompt." + ) + get :: IO CmdLine get = execParser opts where -- cgit v1.2.3