module TLynx.Parsers
( NewickFormat,
newickFormat,
newickHelp,
)
where
import Data.List (intercalate)
import ELynx.Import.Tree.Newick
( NewickFormat (..),
description,
)
import ELynx.Tools (allValues)
import Options.Applicative
newickFormat :: Parser NewickFormat
newickFormat =
option auto $
long "newick-format"
<> short 'f'
<> metavar "FORMAT"
<> value Standard
<> help ("Newick tree format: " ++ nwlist ++ "; default: Standard; for detailed help, see 'tlynx --help'")
where
nwfs = map show (allValues :: [NewickFormat])
nwlist = intercalate ", " (init nwfs) <> ", or " <> last nwfs
newickHelp :: [String]
newickHelp = map (toListItem . description) (allValues :: [NewickFormat])
where
toListItem = ("- Newick " ++)