module Options.Nested.Types where

import Options.Nested.Types.Parser

import           Control.Applicative
import           Data.Maybe          (isJust)
import           Data.Monoid
import           Data.Tree



-- | A command tree is a rose tree of the command label and it's optional flag
-- parser.
type CommandTree a = Forest (String, Maybe a)

-- | A list of the acceptable sub-command invocations for a given rose-tree
-- schema.
executables :: CommandTree b -> [[String]]
executables =
  map (map fst) . filter (isJust . snd . last) . concatMap steps


data LabelledArg a = LabelledArg Label a
  deriving (Show, Eq)

data PositionedArg a = PositionedArg a
  deriving (Show, Eq)

data Label = ShortLabel Char
           | LongLabel String
           | BothLabels Char String
  deriving (Show, Eq)
