aboutsummaryrefslogtreecommitdiff
path: root/compiler/app
diff options
context:
space:
mode:
authorpacien2019-12-27 11:07:58 +0100
committerpacien2019-12-27 11:07:58 +0100
commitc3f1d45743e274f588e5a23ba25e1fc124728c11 (patch)
tree9e8717e06a2e355ad7eed7590ecc3e1b6292fabb /compiler/app
parent6bc29b5db2c8de62e2d9f21c25fa8dcd1ec5a75b (diff)
downloadldgallery-c3f1d45743e274f588e5a23ba25e1fc124728c11.tar.gz
compiler: add command line interface
Diffstat (limited to 'compiler/app')
-rw-r--r--compiler/app/Main.hs35
1 files changed, 31 insertions, 4 deletions
diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs
index 2511998..be57c82 100644
--- a/compiler/app/Main.hs
+++ b/compiler/app/Main.hs
@@ -17,14 +17,41 @@
17-- along with this program. If not, see <https://www.gnu.org/licenses/>. 17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18 18
19{-# LANGUAGE 19{-# LANGUAGE
20 DuplicateRecordFields 20 RecordWildCards
21 , DeriveGeneric 21 , ApplicativeDo
22 , DeriveAnyClass
23#-} 22#-}
24 23
25module Main where 24module Main where
26 25
26import Options.Applicative
27import Data.Semigroup ((<>))
27import Compiler 28import Compiler
28 29
30data Args = Args
31 { inputDir :: String
32 , outputDir :: String }
33
34args :: Parser Args
35args = Args
36 <$> strOption
37 ( long "input"
38 <> short 'i'
39 <> metavar "INPUT DIR"
40 <> help "Gallery source directory" )
41 <*> strOption
42 ( long "output"
43 <> short 'o'
44 <> metavar "OUTPUT DIR"
45 <> help "Generated gallery output path, outside of the input directory" )
46
29main :: IO () 47main :: IO ()
30main = compileGallery "../../example" "../../out" 48main =
49 do
50 options <- execParser opts
51 compileGallery (inputDir options) (outputDir options)
52
53 where
54 opts = info (args <**> helper)
55 ( fullDesc
56 <> progDesc "Compile a picture gallery"
57 <> header "ldgallery - A static generator which turns a collection of tagged pictures into a searchable web gallery.")