git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add makefile gen, help command to pscpp
0eacad3Andy Arvanitis
app/Main.hs+19
@@ -60,6 +60,10 @@ main = do
60 if "--tests" `elem` opts'
60 if "--tests" `elem` opts'
61 then runTests
61 then runTests
62 else do
62 else do
63+ when ("--makefile" `elem` opts') $
64+ T.writeFile "Makefile" $ T.decodeUtf8 $(embedFile "support/Makefile")
65+ when ("--help" `elem` opts') $
66+ putStrLn help
63 mapM (generateCode opts') files
67 mapM (generateCode opts') files
64 return ()
68 return ()
65
69
@@ -128,3 +132,18 @@ toUCNs = T.pack . concatMap toUCN . T.unpack
128toUCN :: Char -> String
132toUCN :: Char -> String
129toUCN c | isAscii c = [c]
133toUCN c | isAscii c = [c]
130toUCN c = printf "\\U%08x" $ ord c
134toUCN c = printf "\\U%08x" $ ord c
135+
136+help :: String
137+help = "Usage: pscpp OPTIONS COREFN-FILES\n\
138+ \ PureScript-to-C++ compiler\n\n\
139+ \Available options:\n\
140+ \ --help Show this help text\n\n\
141+ \ --makefile Generate a GNU Makefile which can be used for compiling\n\
142+ \ a PureScript program and libraries to a native binary via\n\
143+ \ purs corefn output and C++\n\n\
144+ \ --ucns Use UCN encoding of unicode characters in literals and\n\
145+ \ strings in generated C++ code (for compilers that do not\n\
146+ \ support unicode literals, such as gcc)\n\n\
147+ \ --tests Run test cases (under construction)\n\n\
148+ \See also:\n\
149+ \ purs compile --help\n"