diff options
Diffstat (limited to 'compiler/app/Main.hs')
-rw-r--r-- | compiler/app/Main.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs index be57c82..d9b019a 100644 --- a/compiler/app/Main.hs +++ b/compiler/app/Main.hs | |||
@@ -29,29 +29,38 @@ import Compiler | |||
29 | 29 | ||
30 | data Args = Args | 30 | data Args = Args |
31 | { inputDir :: String | 31 | { inputDir :: String |
32 | , outputDir :: String } | 32 | , outputDir :: String |
33 | , rebuild :: Bool } | ||
33 | 34 | ||
34 | args :: Parser Args | 35 | args :: Parser Args |
35 | args = Args | 36 | args = Args |
36 | <$> strOption | 37 | <$> strOption |
37 | ( long "input" | 38 | ( long "input" |
38 | <> short 'i' | 39 | <> short 'i' |
39 | <> metavar "INPUT DIR" | 40 | <> metavar "SOURCE DIR" |
41 | <> value "./" | ||
42 | <> showDefault | ||
40 | <> help "Gallery source directory" ) | 43 | <> help "Gallery source directory" ) |
41 | <*> strOption | 44 | <*> strOption |
42 | ( long "output" | 45 | ( long "output" |
43 | <> short 'o' | 46 | <> short 'o' |
44 | <> metavar "OUTPUT DIR" | 47 | <> metavar "OUTPUT DIR" |
45 | <> help "Generated gallery output path, outside of the input directory" ) | 48 | <> value "./out" |
49 | <> showDefault | ||
50 | <> help "Generated gallery output path" ) | ||
51 | <*> switch | ||
52 | ( long "rebuild" | ||
53 | <> short 'r' | ||
54 | <> help "Invalidate cache and recompile everything" ) | ||
46 | 55 | ||
47 | main :: IO () | 56 | main :: IO () |
48 | main = | 57 | main = |
49 | do | 58 | do |
50 | options <- execParser opts | 59 | options <- execParser opts |
51 | compileGallery (inputDir options) (outputDir options) | 60 | compileGallery (inputDir options) (outputDir options) (rebuild options) |
52 | 61 | ||
53 | where | 62 | where |
54 | opts = info (args <**> helper) | 63 | opts = info (args <**> helper) |
55 | ( fullDesc | 64 | ( fullDesc |
56 | <> progDesc "Compile a picture gallery" | 65 | <> progDesc "Compile a gallery" |
57 | <> header "ldgallery - A static generator which turns a collection of tagged pictures into a searchable web gallery.") | 66 | <> header "ldgallery - a static gallery generator with tags" ) |