summaryrefslogtreecommitdiffhomepage
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-04 12:30:39 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-04 12:30:39 -0400
commitc7dba730abf38e31d38dec1028d9844e0724e707 (patch)
tree386003db1f18f272a2bc95757f7b0f0cc581a9c9 /CmdLine.hs
parent75cfb0df9467a2b07bb93e71ca55937839d53715 (diff)
downloadkeysafe-c7dba730abf38e31d38dec1028d9844e0724e707.tar.gz
Added --name and --othername options.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs19
1 files changed, 17 insertions, 2 deletions
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