packages feed

questioner 0.1.0.0 → 0.1.1.0

raw patch · 2 files changed

+19/−8 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

questioner.cabal view
@@ -1,5 +1,5 @@ name:                questioner-version:             0.1.0.0+version:             0.1.1.0 synopsis:            A package for prompting values from the command-line. description:         This is still being developed homepage:            https://github.com/yamadapc/haskell-questioner.git
src/System/Console/Questioner.hs view
@@ -18,7 +18,8 @@ import Control.Applicative ((<$>)) import Control.Monad ((>=>), forM_) import Data.List (delete)-import System.Console.ANSI (clearLine, cursorUpLine)+import System.Console.ANSI (SGR(..), Color(..), ColorIntensity(..),+                            ConsoleLayer(..), clearLine, cursorUpLine, setSGR) import System.IO (stdin)  import System.Console.Questioner.ProgressIndicators@@ -93,8 +94,15 @@     updateSelection _ _ = error "Internal error, key not recognized"      render (s, optionsI) = forM_ optionsI $ \(o, i) ->-        putStrLn $ (if i == s then "> " else "  ") ++ o+        if i == s+            then do+                setSGR [ SetColor Foreground Vivid Blue ]+                putStrLn $ "> " ++ o+                setSGR []+            else putStrLn $ "  " ++ o +        -- putStrLn $ (if i == s then "> " else "  ") ++ o+ checkboxPrompt :: String -> [String] -> IO [String] checkboxPrompt question options = setup $ do     putStrLn question@@ -129,8 +137,11 @@         is' = if i `elem` is then delete i is else i:is     updateSelection _ _ = error "Internal error, key not recognized" -    render (i, is, optionsI) =-        forM_ optionsI $ \(o, j) ->-            putStrLn $ (if i == j then ">" else " ") ++-                       (if j `elem` is then "◉ " else "◯ ") ++-                       o+    render (i, is, optionsI) = forM_ optionsI $ \(o, j) -> do+        let checkbox = if j `elem` is then "◉ " else "◯ "+        if i == j+            then do+                setSGR [ SetColor Foreground Vivid Blue ]+                putStrLn $ ">" ++ checkbox ++ o+                setSGR []+            else putStrLn $ " " ++ checkbox ++ o