This commit is contained in:
Dmitry Zuikov 2024-04-13 08:16:01 +03:00
parent d30207f838
commit 7c5ddace1c
4 changed files with 13 additions and 6 deletions

View File

@ -170,4 +170,3 @@ executable git-remote-hbs2

View File

@ -35,11 +35,13 @@ globalOptions = pure GlobalOptions
type AppPerks m = (MonadIO m, MonadUnliftIO m, MonadReader AppEnv m, HasConf m, SerialisedCredentials 'HBS2Basic) type AppPerks m = (MonadIO m, MonadUnliftIO m, MonadReader AppEnv m, HasConf m, SerialisedCredentials 'HBS2Basic)
-- Парсер для команд -- TODO: key-mamagement-command-about-to-move-here
commands :: (AppPerks m) => Parser (Command m) commands :: (AppPerks m) => Parser (Command m)
commands = hsubparser commands = hsubparser
( command "update" (O.info (updateKeys <**> helper) (progDesc "update keys" )) ( command "update" (O.info (updateKeys <**> helper) (progDesc "update keys" ))
<> command "list" (O.info (listKeysCmd <**> helper) (progDesc "list keys" )) <> command "list" (O.info (listKeysCmd <**> helper) (progDesc "list keys" ))
<> command "disclose" (O.info (discloseKeyCmd <**> helper) (progDesc "disclose credentials" ))
<> command "set-weight" (O.info (setWeightCmd <**> helper) (progDesc "set weight for a key")) <> command "set-weight" (O.info (setWeightCmd <**> helper) (progDesc "set weight for a key"))
<> command "add-mask" (O.info (addPath <**> helper) (progDesc "add path/mask to search keys, ex. '/home/user/keys/*.key'")) <> command "add-mask" (O.info (addPath <**> helper) (progDesc "add path/mask to search keys, ex. '/home/user/keys/*.key'"))
<> command "config" (O.info (showConfig <**> helper) (progDesc "show hbs2-keyman config")) <> command "config" (O.info (showConfig <**> helper) (progDesc "show hbs2-keyman config"))
@ -116,6 +118,12 @@ setWeightCmd = do
pure do pure do
withState $ updateKeyWeight k v withState $ updateKeyWeight k v
discloseKeyCmd :: (AppPerks m) => Parser (Command m)
discloseKeyCmd = do
-- k <- argument str (metavar "KEY" <> help "Key identifier")
-- v <- argument auto (metavar "WEIGHT" <> help "Weight value")
pure do
notice "WIP"
main :: IO () main :: IO ()
main = do main = do

View File

@ -115,9 +115,9 @@ executable hbs2-keyman
-- other-modules: -- other-modules:
-- other-extensions: -- other-extensions:
build-depends: build-depends:
base, base
hbs2-keyman, , hbs2-keyman
optparse-applicative , optparse-applicative
hs-source-dirs: app hs-source-dirs: app
default-language: GHC2021 default-language: GHC2021

View File

@ -18,7 +18,7 @@ common warnings
common common-deps common common-deps
build-depends: build-depends:
base, hbs2-core, hbs2-storage-simple, hbs2-keyman base, hbs2-core, hbs2-storage-simple
, aeson , aeson
, async , async
, bytestring , bytestring