-
Notifications
You must be signed in to change notification settings - Fork 16
/
arx.hs
executable file
·31 lines (22 loc) · 983 Bytes
/
arx.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env runhaskell
{-# LANGUAGE TemplateHaskell #-}
import Control.Applicative
import Data.ByteString (ByteString)
import qualified Data.ByteString
import System.Environment
import System.Exit
import System.IO
import System.Process
import Data.FileEmbed
import qualified System.Posix.ARX.CLI
main :: IO ()
main = do
flags <- (,) <$> checkHelp <*> checkVersion
case flags of (True, _) -> Data.ByteString.putStr usage >> exitSuccess
(_, True) -> Data.ByteString.putStr version >> exitSuccess
(_, _) -> System.Posix.ARX.CLI.main
checkHelp = checkOne ["-h", "-?", "--help"]
checkVersion = checkOne ["-v", "--version"]
checkOne list = any (`elem` list) . take 1 <$> getArgs
usage = $(embedFile "./docs/blessed/arx.txt")
version = $(embedFile "./version")