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