Created
January 24, 2019 13:33
-
-
Save vvv/431417e4620fa7d0064d53d51fe56746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
{- stack --resolver lts-9.21 script | |
--package shelly --package text | |
-} | |
{-# OPTIONS_GHC -Wall -Werror #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ExtendedDefaultRules #-} | |
{-# OPTIONS_GHC -fno-warn-type-defaults #-} | |
import Shelly | |
-- import Control.Monad (void) | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import System.Environment (getProgName) | |
default (Text) | |
src_dir :: Sh Text | |
src_dir = silently $ do | |
prog <- T.pack <$> liftIO getProgName | |
run "readlink" ["-f", prog] | |
main :: IO () | |
main = shelly $ do | |
echo . T.append "PWD=" =<< get_env_text "PWD" | |
let hr = echo . T.pack . take 70 $ repeat '-' | |
hr | |
run_ "ls" [] -- `cmd "ls"` won't compile with `-Wall` | |
hr | |
src_dir >>= inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment