Permalink
Browse files

Update readme; add back help message.

  • Loading branch information...
1 parent fe3e26f commit 195929eb09625fe9b3143aba714f9b3f9c71503b @steveWang committed Aug 27, 2012
Showing with 20 additions and 3 deletions.
  1. +2 −2 README.md
  2. +18 −1 src/bifurcate.hs
View
@@ -1,6 +1,6 @@
Readme
======
-bifurcate is a program written in C++ (for some strange reason) that enables
-multicast for bash pipes. WIP. Requires g++ to make. (also, make if you want to
+bifurcate is a program written in Haskell that enables multicast for bash
+pipes. Highly experimental. Requires ghc to build. (also, make if you want to
use the provided Makefile)
View
@@ -13,6 +13,16 @@ process "c" cmd = do
x <- createProcess (shell cmd) {std_in = CreatePipe}
let (Just ihandle, _, _, _) = x in
return ihandle
+printHelp = do
+ putStrLn "Usage: bifurcate type targets...\n\
+ \Types:\n\
+ \ -a Open the specified file(s) for appending.\n\
+ \ -w Open the specified file(s) for writing\n\
+ \ (WARNING: will overwrite file contents).\n\
+ \ -c Run the specified commands.\n\
+ \ -h Print this help message.\n\
+ \\n\
+ \Note: targets corresponds to possible inputs."
collect :: String -> [String] -> [IO Handle]
collect t [] = []
@@ -32,8 +42,15 @@ multicast (x : xs) c = do
hFlush hdl
multicast xs c
+bifurcate :: [String] -> String -> IO ()
+bifurcate args c
+ | (any (\ x -> x == "-h" || x == "--help") args) = do
+ printHelp
+ return ()
+ | otherwise = multicast (parseArgs args) c
+
main :: IO ()
main = do
args <- getArgs
c <- getContents
- multicast (parseArgs args) c
+ bifurcate args c

0 comments on commit 195929e

Please sign in to comment.