packages feed

shh 0.3.1.0 → 0.3.1.1

raw patch · 3 files changed

+37/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -162,6 +162,15 @@ it is up to you to make sure that the compiler, and packages you require are available, either globally, or provided by the `wrapper` script. +#### Nix Wrapper Example++The following snippet could act as a `wrapper` file to set up a suitable+environment using `nix-shell`++    #! /usr/bin/env nix-shell+    #! nix-shell -i bash -p "(haskellPackages.ghcWithPackages (p: with p; [shh shh-extras]))"+    exec "$@"+ ### Script Usage  TODO: Fill this in once the user experience is better.
app/shh-app.hs view
@@ -4,6 +4,7 @@ import Shh import System.IO import System.Environment+import System.Exit import System.IO.Temp import System.Directory import Data.Hashable (hash)@@ -19,6 +20,9 @@ defaultInitGhci = "\ \:seti -XNoOverloadedLists\n\ \import Shh\n\+\ "++extraInitGhci = "\ \import Shh.Prompt\n\ \:set prompt-function formatPrompt \"\\n\\ESC[1;32m[%u@%h:%w]λ \\ESC[0m\"\n\ \:set prompt-cont \"| \"\n\@@ -32,12 +36,15 @@  debug = putStrLn -writeIfMissing :: FilePath -> String -> IO ()-writeIfMissing fp s = do+doIfMissing :: FilePath -> IO () -> IO ()+doIfMissing fp a = do     doesFileExist fp >>= \case         True -> pure ()-        False -> writeFile fp s+        False -> a +writeIfMissing :: FilePath -> String -> IO ()+writeIfMissing fp s = doIfMissing fp (writeFile fp s)+ main :: IO () main = do     a <- getArgs@@ -57,13 +64,29 @@     createDirectoryIfMissing False shhDir      withCurrentDirectory shhDir $ do-        writeIfMissing "init.ghci" defaultInitGhci         writeIfMissing "wrapper" defaultWrapper         setPermissions "wrapper" $             setOwnerExecutable True $             setOwnerReadable True $             setOwnerWritable True $             emptyPermissions+        doIfMissing "init.ghci" $ do+            catchFailure (exe wrapper "ghc-pkg" "latest" "shh") >>= \case+                Left _ -> do+                    putStrLn "Please make the shh and shh-extras packages available in the shh"+                    putStrLn "environment (install it globally or modify the wrapper, see docs)."+                    putStrLn "Aborting"+                    exitFailure+                Right _ -> writeFile "init.ghci" defaultInitGhci+            catchFailure (exe wrapper "ghc-pkg" "latest" "shh-extras") >>= \case+                Left _ -> do+                    putStrLn "## WARNING ##########################################################"+                    putStrLn "# You do not have the shh-extras library installed, and so we are"+                    putStrLn "# generating a reduced functionality init.ghci file. To restore full"+                    putStrLn "# functionality, install shh-extras and re-generate your init.ghci"+                    putStrLn $ "# file by deleting " <> shhDir <> "/init.ghci and re-running shh"+                    putStrLn "#####################################################################"+                Right _ -> appendFile "init.ghci" extraInitGhci         writeIfMissing "Shell.hs" defaultShell      runProc $ mkProc' True wrapper ["ghci", "-ghci-script", shhDir <> "/init.ghci", shhDir <> "/Shell.hs"]
shh.cabal view
@@ -1,5 +1,5 @@ name:                shh-version:             0.3.1.0+version:             0.3.1.1 synopsis:            Simple shell scripting from Haskell description:         Provides a shell scripting environment for Haskell. It                      helps you all external binaries, and allows you to