implemented service renaming
This commit is contained in:
12
app/Util.hs
12
app/Util.hs
@@ -24,6 +24,7 @@ module Util
|
||||
( menu
|
||||
, run
|
||||
, withService
|
||||
, ifServExists
|
||||
, setService
|
||||
, req
|
||||
, tryReq
|
||||
@@ -82,6 +83,17 @@ withService srv fb act = do
|
||||
Nothing -> fb
|
||||
Just x -> act x
|
||||
|
||||
ifServExists
|
||||
:: String
|
||||
-> S.StateT Status IO a
|
||||
-> S.StateT Status IO a
|
||||
-> S.StateT Status IO a
|
||||
ifServExists s x y = do
|
||||
db <- S.gets $ view database
|
||||
if pwHasService s db
|
||||
then x
|
||||
else y
|
||||
|
||||
setService :: String -> PWData -> S.StateT Status IO ()
|
||||
setService k = S.modify . over database . pwSetService k
|
||||
|
||||
|
||||
Reference in New Issue
Block a user