aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-02-25 14:00:21 -0800
committerGitHub <noreply@github.com>2020-02-25 14:00:21 -0800
commit5d38dffc1023cef688e055019fa2569618cf1a4d (patch)
tree7b13ccc55588d467708c20f14b114cc56bb93b0b /app
parent2292bbd1d57c97d800e87e1cb6ccd1981ad50333 (diff)
parentd9cd40f9d84e104207f8ef34c6d5a4f9d1b3af4b (diff)
downloadfpm-5d38dffc1023cef688e055019fa2569618cf1a4d.tar.gz
fpm-5d38dffc1023cef688e055019fa2569618cf1a4d.zip
Merge pull request #40 from everythingfunctional/master
Switch to using Haskell
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs43
1 files changed, 43 insertions, 0 deletions
diff --git a/app/Main.hs b/app/Main.hs
new file mode 100644
index 0000000..9d9c5dc
--- /dev/null
+++ b/app/Main.hs
@@ -0,0 +1,43 @@
+module Main where
+
+import Options.Applicative
+
+newtype Arguments = Arguments { command' :: Command }
+
+data Command = Run | Test | Build
+
+main :: IO ()
+main = do
+ args <- getArguments
+ run args
+
+run :: Arguments -> IO ()
+run args = case command' args of
+ Run -> putStrLn "Run"
+ Test -> putStrLn "Test"
+ Build -> putStrLn "Build"
+
+getArguments :: IO Arguments
+getArguments = execParser
+ (info
+ (arguments <**> helper)
+ (fullDesc <> progDesc "Work with Fortran projects" <> header
+ "fpm - A Fortran package manager and build system"
+ )
+ )
+
+arguments :: Parser Arguments
+arguments = subparser
+ ( command "run" (info runArguments (progDesc "Run the executable"))
+ <> command "test" (info testArguments (progDesc "Run the tests"))
+ <> command "build" (info buildArguments (progDesc "Build the executable"))
+ )
+
+runArguments :: Parser Arguments
+runArguments = pure $ Arguments Run
+
+testArguments :: Parser Arguments
+testArguments = pure $ Arguments Test
+
+buildArguments :: Parser Arguments
+buildArguments = pure $ Arguments Build