packages feed

shh-extras 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+26/−2 lines, 3 filesdep +tastydep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: tasty

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

shh-extras.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                shh-extras-version:             0.1.0.0+version:             0.1.0.1 synopsis:            Utility functions for using shh description:         Provides useful functions for setting up Shh as an                      interactive shell.@@ -26,3 +26,13 @@     hostname   hs-source-dirs:      src   default-language:    Haskell2010++test-suite shh-extra-tests+  ghc-options: -threaded -with-rtsopts=-N+  default-language: Haskell2010+  build-depends:+    base >=4.9,+    tasty+  hs-source-dirs: test+  main-is: Main.hs+  type: exitcode-stdio-1.0
src/Shh/Prompt.hs view
@@ -6,6 +6,7 @@ import System.Environment import Network.HostName import Data.Time+import Data.List  -- | The type of GHCi prompt functions type PromptFn = [String] -> Int -> IO String@@ -35,7 +36,7 @@             format :: String -> IO String             format ('%' : '%' : rest) = ('%':) <$> format rest             format ('%' : 'u' : rest) = insertEnv "USER" rest-            format ('%' : 'w' : rest) = insertEnv "PWD" rest+            format ('%' : 'w' : rest) = insertIO prettyPwd rest             format ('%' : 'h' : rest) = insertIO getHostName rest             format ('%' : 't' : rest) = insertIO getTime rest             format ( x  : rest) = (x:) <$> format rest@@ -51,3 +52,12 @@             getTime = formatTime defaultTimeLocale "%H:%M:%S" <$>                 (utcToLocalTime <$> getCurrentTimeZone <*> getCurrentTime) +            prettyPwd :: IO String+            prettyPwd = do+                pwd  <- getEnv "PWD"+                home <- getEnv "HOME"+                if home `isPrefixOf` pwd+                then+                    pure $ "~" <> drop (length home) pwd+                else+                    pure pwd
+ test/Main.hs view
@@ -0,0 +1,4 @@+module Main where++main :: IO ()+main = pure ()