module OrgStat.CLI
( CommonArgs (..)
, parseCommonArgs
) where
import Universum
import Options.Applicative.Simple (Parser, help, long, metavar, strOption, switch)
data CommonArgs = CommonArgs
{ caXdgOpen :: !Bool
, caOutputs :: ![Text]
, caOutputDir :: !(Maybe FilePath)
} deriving Show
parseCommonArgs :: Parser CommonArgs
parseCommonArgs =
CommonArgs <$>
switch (long "xdg-open" <> help "Open each report using xdg-open") <*>
many (
fromString <$>
strOption (long "output" <>
long "select-output" <>
help ("Output name(s) you want to process " <>
"(by default all outputs from conf are selected)"))) <*>
optional (
strOption (long "output-dir" <>
metavar "FILEPATH" <>
help ("Final output directory that overrides one in config. " <>
"No extra subdirectories will be created!")))