aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs41
-rw-r--r--package.yaml1
-rw-r--r--stack.yaml2
-rw-r--r--stack.yaml.lock8
4 files changed, 45 insertions, 7 deletions
diff --git a/app/Main.hs b/app/Main.hs
index de1c1ab..9d9c5dc 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,6 +1,43 @@
module Main where
-import Lib
+import Options.Applicative
+
+newtype Arguments = Arguments { command' :: Command }
+
+data Command = Run | Test | Build
main :: IO ()
-main = someFunc
+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
diff --git a/package.yaml b/package.yaml
index ab3a1d0..2cf73a8 100644
--- a/package.yaml
+++ b/package.yaml
@@ -21,6 +21,7 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies:
- base >= 4.7 && < 5
+- optparse-applicative
library:
source-dirs: src
diff --git a/stack.yaml b/stack.yaml
index 465f104..0094ee9 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -17,7 +17,7 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
-resolver: lts-15.1
+resolver: lts-12.26
# User packages to be built.
# Various formats can be used as shown in the example below.
diff --git a/stack.yaml.lock b/stack.yaml.lock
index 7e51098..6bee1e8 100644
--- a/stack.yaml.lock
+++ b/stack.yaml.lock
@@ -6,7 +6,7 @@
packages: []
snapshots:
- completed:
- size: 489011
- url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/1.yaml
- sha256: d4ecc42b7125d68e4c3c036a08046ad0cd02ae0d9efbe3af2223a00ff8cc16f3
- original: lts-15.1
+ size: 509471
+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/12/26.yaml
+ sha256: 95f014df58d0679b1c4a2b7bf2b652b61da8d30de5f571abb0d59015ef678646
+ original: lts-12.26