module System.Shana.DSL.Shell where

import Prelude hiding ((>), (-), (.))
import System.Shana.Utils
import System.Shana
import Text.Regex.Posix

import System.Directory
import Data.List ((\\))
import Control.Applicative ((<$>))


ls :: String -> Shana String String
ls x = Shana - const - (\\ [".", ".."]) <$> getDirectoryContents x

grep :: String -> Shana String String
grep x = Shana - \l -> return -
  if l =~ x
    then [l]
    else []