{-# LANGUAGE NoImplicitPrelude     #-}
{-# LANGUAGE NoFieldSelectors      #-}

{-|
Module      : Stack.Types.LsOpts
Description : Types related to Stack's @ls@ command.
License     : BSD-3-Clause

Types related to Stack's @ls@ command.
-}

module Stack.Types.LsOpts
  ( LsCmdOpts (..)
  , LsCmds (..)
  , SnapshotOpts (..)
  , LsView (..)
  , ListDepsOpts (..)
  , ListDepsFormat (..)
  , ListDepsFormatOpts (..)
  , ListDepsTextFilter (..)
  , ListGlobalsOpts (..)
  , ListStylesOpts (..)
  , ListToolsOpts (..)
  ) where

import           Stack.Prelude
import           Stack.Types.DotOpts ( DotOpts (..) )

-- | Type representing command line options for the @stack ls@ command.

newtype LsCmdOpts
  = LsCmdOpts { LsCmdOpts -> LsCmds
lsCmds :: LsCmds }

-- | Type representing subcommands for the @stack ls@ command.

data LsCmds
  = LsSnapshot SnapshotOpts
  | LsGlobals ListGlobalsOpts
  | LsDependencies ListDepsOpts
  | LsStyles ListStylesOpts
  | LsTools ListToolsOpts

-- | Type representing command line options for the @stack ls snapshots@

-- command.

data SnapshotOpts = SnapshotOpts
  { SnapshotOpts -> LsView
viewType :: LsView
  , SnapshotOpts -> Bool
ltsSnapView :: Bool
  , SnapshotOpts -> Bool
nightlySnapView :: Bool
  }
  deriving (SnapshotOpts -> SnapshotOpts -> Bool
(SnapshotOpts -> SnapshotOpts -> Bool)
-> (SnapshotOpts -> SnapshotOpts -> Bool) -> Eq SnapshotOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SnapshotOpts -> SnapshotOpts -> Bool
== :: SnapshotOpts -> SnapshotOpts -> Bool
$c/= :: SnapshotOpts -> SnapshotOpts -> Bool
/= :: SnapshotOpts -> SnapshotOpts -> Bool
Eq, Eq SnapshotOpts
Eq SnapshotOpts =>
(SnapshotOpts -> SnapshotOpts -> Ordering)
-> (SnapshotOpts -> SnapshotOpts -> Bool)
-> (SnapshotOpts -> SnapshotOpts -> Bool)
-> (SnapshotOpts -> SnapshotOpts -> Bool)
-> (SnapshotOpts -> SnapshotOpts -> Bool)
-> (SnapshotOpts -> SnapshotOpts -> SnapshotOpts)
-> (SnapshotOpts -> SnapshotOpts -> SnapshotOpts)
-> Ord SnapshotOpts
SnapshotOpts -> SnapshotOpts -> Bool
SnapshotOpts -> SnapshotOpts -> Ordering
SnapshotOpts -> SnapshotOpts -> SnapshotOpts
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SnapshotOpts -> SnapshotOpts -> Ordering
compare :: SnapshotOpts -> SnapshotOpts -> Ordering
$c< :: SnapshotOpts -> SnapshotOpts -> Bool
< :: SnapshotOpts -> SnapshotOpts -> Bool
$c<= :: SnapshotOpts -> SnapshotOpts -> Bool
<= :: SnapshotOpts -> SnapshotOpts -> Bool
$c> :: SnapshotOpts -> SnapshotOpts -> Bool
> :: SnapshotOpts -> SnapshotOpts -> Bool
$c>= :: SnapshotOpts -> SnapshotOpts -> Bool
>= :: SnapshotOpts -> SnapshotOpts -> Bool
$cmax :: SnapshotOpts -> SnapshotOpts -> SnapshotOpts
max :: SnapshotOpts -> SnapshotOpts -> SnapshotOpts
$cmin :: SnapshotOpts -> SnapshotOpts -> SnapshotOpts
min :: SnapshotOpts -> SnapshotOpts -> SnapshotOpts
Ord, Int -> SnapshotOpts -> ShowS
[SnapshotOpts] -> ShowS
SnapshotOpts -> String
(Int -> SnapshotOpts -> ShowS)
-> (SnapshotOpts -> String)
-> ([SnapshotOpts] -> ShowS)
-> Show SnapshotOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SnapshotOpts -> ShowS
showsPrec :: Int -> SnapshotOpts -> ShowS
$cshow :: SnapshotOpts -> String
show :: SnapshotOpts -> String
$cshowList :: [SnapshotOpts] -> ShowS
showList :: [SnapshotOpts] -> ShowS
Show)

-- | Type representing subcommands for the @stack ls snapshots@ command.

data LsView
  = Local
  | Remote
  deriving (LsView -> LsView -> Bool
(LsView -> LsView -> Bool)
-> (LsView -> LsView -> Bool) -> Eq LsView
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LsView -> LsView -> Bool
== :: LsView -> LsView -> Bool
$c/= :: LsView -> LsView -> Bool
/= :: LsView -> LsView -> Bool
Eq, Eq LsView
Eq LsView =>
(LsView -> LsView -> Ordering)
-> (LsView -> LsView -> Bool)
-> (LsView -> LsView -> Bool)
-> (LsView -> LsView -> Bool)
-> (LsView -> LsView -> Bool)
-> (LsView -> LsView -> LsView)
-> (LsView -> LsView -> LsView)
-> Ord LsView
LsView -> LsView -> Bool
LsView -> LsView -> Ordering
LsView -> LsView -> LsView
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: LsView -> LsView -> Ordering
compare :: LsView -> LsView -> Ordering
$c< :: LsView -> LsView -> Bool
< :: LsView -> LsView -> Bool
$c<= :: LsView -> LsView -> Bool
<= :: LsView -> LsView -> Bool
$c> :: LsView -> LsView -> Bool
> :: LsView -> LsView -> Bool
$c>= :: LsView -> LsView -> Bool
>= :: LsView -> LsView -> Bool
$cmax :: LsView -> LsView -> LsView
max :: LsView -> LsView -> LsView
$cmin :: LsView -> LsView -> LsView
min :: LsView -> LsView -> LsView
Ord, Int -> LsView -> ShowS
[LsView] -> ShowS
LsView -> String
(Int -> LsView -> ShowS)
-> (LsView -> String) -> ([LsView] -> ShowS) -> Show LsView
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LsView -> ShowS
showsPrec :: Int -> LsView -> ShowS
$cshow :: LsView -> String
show :: LsView -> String
$cshowList :: [LsView] -> ShowS
showList :: [LsView] -> ShowS
Show)

-- | Type representing command line options for the @stack ls globals@ command.

newtype ListGlobalsOpts = ListGlobalsOpts
  { ListGlobalsOpts -> Bool
globalHints :: Bool
    -- ^ Use global hints instead of relying on an actual GHC installation.

  }

-- | Type representing command line options for the @stack ls dependencies@

-- command.

data ListDepsOpts = ListDepsOpts
  { ListDepsOpts -> ListDepsFormat
format :: !ListDepsFormat
    -- ^ Format of printing dependencies

  , ListDepsOpts -> DotOpts
dotOpts :: !DotOpts
    -- ^ The normal dot options.

  }

-- | Type representing formats for printing dependencies.

data ListDepsFormat
  = ListDepsText ListDepsFormatOpts [ListDepsTextFilter]
  | ListDepsTree ListDepsFormatOpts
  | ListDepsJSON
  | ListDepsConstraints

-- | Type representing command line options for the @stack ls dependencies text@

-- command and similar @cabal@, @tree@ and @json@ commands.

data ListDepsFormatOpts = ListDepsFormatOpts
  { ListDepsFormatOpts -> Text
sep :: !Text
    -- ^ Separator between the package name and details.

  , ListDepsFormatOpts -> Bool
license :: !Bool
    -- ^ Print dependency licenses instead of versions.

  }

-- | Type representing items to filter the results of @stack ls dependencies@.

data ListDepsTextFilter
  = FilterPackage PackageName
    -- ^ Item is a package name.

  | FilterLocals
    -- ^ Item represents all project packages.


-- | Type representing command line options for the @stack ls stack-colors@ and

-- @stack ls stack-colours@ commands.

data ListStylesOpts = ListStylesOpts
  { ListStylesOpts -> Bool
basic   :: Bool
  , ListStylesOpts -> Bool
sgr     :: Bool
  , ListStylesOpts -> Bool
example :: Bool
  }
  deriving (ListStylesOpts -> ListStylesOpts -> Bool
(ListStylesOpts -> ListStylesOpts -> Bool)
-> (ListStylesOpts -> ListStylesOpts -> Bool) -> Eq ListStylesOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListStylesOpts -> ListStylesOpts -> Bool
== :: ListStylesOpts -> ListStylesOpts -> Bool
$c/= :: ListStylesOpts -> ListStylesOpts -> Bool
/= :: ListStylesOpts -> ListStylesOpts -> Bool
Eq, Eq ListStylesOpts
Eq ListStylesOpts =>
(ListStylesOpts -> ListStylesOpts -> Ordering)
-> (ListStylesOpts -> ListStylesOpts -> Bool)
-> (ListStylesOpts -> ListStylesOpts -> Bool)
-> (ListStylesOpts -> ListStylesOpts -> Bool)
-> (ListStylesOpts -> ListStylesOpts -> Bool)
-> (ListStylesOpts -> ListStylesOpts -> ListStylesOpts)
-> (ListStylesOpts -> ListStylesOpts -> ListStylesOpts)
-> Ord ListStylesOpts
ListStylesOpts -> ListStylesOpts -> Bool
ListStylesOpts -> ListStylesOpts -> Ordering
ListStylesOpts -> ListStylesOpts -> ListStylesOpts
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ListStylesOpts -> ListStylesOpts -> Ordering
compare :: ListStylesOpts -> ListStylesOpts -> Ordering
$c< :: ListStylesOpts -> ListStylesOpts -> Bool
< :: ListStylesOpts -> ListStylesOpts -> Bool
$c<= :: ListStylesOpts -> ListStylesOpts -> Bool
<= :: ListStylesOpts -> ListStylesOpts -> Bool
$c> :: ListStylesOpts -> ListStylesOpts -> Bool
> :: ListStylesOpts -> ListStylesOpts -> Bool
$c>= :: ListStylesOpts -> ListStylesOpts -> Bool
>= :: ListStylesOpts -> ListStylesOpts -> Bool
$cmax :: ListStylesOpts -> ListStylesOpts -> ListStylesOpts
max :: ListStylesOpts -> ListStylesOpts -> ListStylesOpts
$cmin :: ListStylesOpts -> ListStylesOpts -> ListStylesOpts
min :: ListStylesOpts -> ListStylesOpts -> ListStylesOpts
Ord, Int -> ListStylesOpts -> ShowS
[ListStylesOpts] -> ShowS
ListStylesOpts -> String
(Int -> ListStylesOpts -> ShowS)
-> (ListStylesOpts -> String)
-> ([ListStylesOpts] -> ShowS)
-> Show ListStylesOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListStylesOpts -> ShowS
showsPrec :: Int -> ListStylesOpts -> ShowS
$cshow :: ListStylesOpts -> String
show :: ListStylesOpts -> String
$cshowList :: [ListStylesOpts] -> ShowS
showList :: [ListStylesOpts] -> ShowS
Show)

-- | Type representing command line options for the @stack ls tools@ command.

newtype ListToolsOpts
  = ListToolsOpts { ListToolsOpts -> String
filter  :: String }