summaryrefslogtreecommitdiffhomepage
path: root/UI
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-17 14:28:33 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-17 14:28:33 -0400
commitf60ac335e4e827fd242ab22539adb49f26e2c319 (patch)
tree255e16e03210b9ccb6faf72b4afd29b7262f42d9 /UI
parentb474ab87ae45ed77f42eb41f658a55262bd92217 (diff)
downloadkeysafe-f60ac335e4e827fd242ab22539adb49f26e2c319.tar.gz
add progress bars to restore
also, restore actually works!
Diffstat (limited to 'UI')
-rw-r--r--UI/Readline.hs6
-rw-r--r--UI/Zenity.hs2
2 files changed, 5 insertions, 3 deletions
diff --git a/UI/Readline.hs b/UI/Readline.hs
index 23be2e3..ed619df 100644
--- a/UI/Readline.hs
+++ b/UI/Readline.hs
@@ -131,7 +131,7 @@ myPromptKeyId title desc l = do
putStrLn $ "Enter a number from 1 to " ++ show (length l)
prompt
-myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO ()) -> IO ()
+myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a
myWithProgress title desc a = bracket_ setup teardown (a sendpercent)
where
setup = do
@@ -140,7 +140,9 @@ myWithProgress title desc a = bracket_ setup teardown (a sendpercent)
sendpercent p = do
putStr (show p ++ "% ")
hFlush stdout
- teardown = putStrLn "done"
+ teardown = do
+ putStrLn "done"
+ putStrLn ""
showTitle :: Title -> IO ()
showTitle title = do
diff --git a/UI/Zenity.hs b/UI/Zenity.hs
index b74631f..228b11a 100644
--- a/UI/Zenity.hs
+++ b/UI/Zenity.hs
@@ -115,7 +115,7 @@ myPromptKeyId title desc l = do
return $ Just (KeyId (BU8.fromString kid))
else return Nothing
-myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO ()) -> IO ()
+myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a
myWithProgress title desc a = bracket setup teardown (a . sendpercent)
where
setup = do