diff options
-rw-r--r-- | compiler/app/Main.hs | 35 | ||||
-rw-r--r-- | compiler/package.yaml | 3 |
2 files changed, 32 insertions, 6 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 | ||
25 | module Main where | 24 | module Main where |
26 | 25 | ||
26 | import Options.Applicative | ||
27 | import Data.Semigroup ((<>)) | ||
27 | import Compiler | 28 | import Compiler |
28 | 29 | ||
30 | data Args = Args | ||
31 | { inputDir :: String | ||
32 | , outputDir :: String } | ||
33 | |||
34 | args :: Parser Args | ||
35 | args = 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 | |||
29 | main :: IO () | 47 | main :: IO () |
30 | main = compileGallery "../../example" "../../out" | 48 | main = |
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.") | ||
diff --git a/compiler/package.yaml b/compiler/package.yaml index 85740ab..e3c1eb6 100644 --- a/compiler/package.yaml +++ b/compiler/package.yaml | |||
@@ -21,8 +21,7 @@ dependencies: | |||
21 | - directory | 21 | - directory |
22 | - aeson | 22 | - aeson |
23 | - yaml | 23 | - yaml |
24 | #- optparse-applicative | 24 | - optparse-applicative |
25 | #- cmdargs | ||
26 | - JuicyPixels | 25 | - JuicyPixels |
27 | - JuicyPixels-extra | 26 | - JuicyPixels-extra |
28 | 27 | ||