Add ListAvailable to ListCriteria
This commit is contained in:
parent
523f2f57e1
commit
fa523d590e
@ -833,8 +833,8 @@ listOpts =
|
|||||||
(eitherReader criteriaParser)
|
(eitherReader criteriaParser)
|
||||||
( short 'c'
|
( short 'c'
|
||||||
<> long "show-criteria"
|
<> long "show-criteria"
|
||||||
<> metavar "<installed|set>"
|
<> metavar "<installed|set|available>"
|
||||||
<> help "Show only installed or set tool versions"
|
<> help "Show only installed/set/available tool versions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<*> switch
|
<*> switch
|
||||||
@ -1438,6 +1438,7 @@ toolParser s' | t == T.pack "ghc" = Right GHC
|
|||||||
criteriaParser :: String -> Either String ListCriteria
|
criteriaParser :: String -> Either String ListCriteria
|
||||||
criteriaParser s' | t == T.pack "installed" = Right ListInstalled
|
criteriaParser s' | t == T.pack "installed" = Right ListInstalled
|
||||||
| t == T.pack "set" = Right ListSet
|
| t == T.pack "set" = Right ListSet
|
||||||
|
| t == T.pack "available" = Right ListAvailable
|
||||||
| otherwise = Left ("Unknown criteria: " <> s')
|
| otherwise = Left ("Unknown criteria: " <> s')
|
||||||
where t = T.toLower (T.pack s')
|
where t = T.toLower (T.pack s')
|
||||||
|
|
||||||
|
@ -1335,6 +1335,7 @@ warnAboutHlsCompatibility = do
|
|||||||
-- | Filter data type for 'listVersions'.
|
-- | Filter data type for 'listVersions'.
|
||||||
data ListCriteria = ListInstalled
|
data ListCriteria = ListInstalled
|
||||||
| ListSet
|
| ListSet
|
||||||
|
| ListAvailable
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
-- | A list result describes a single tool version
|
-- | A list result describes a single tool version
|
||||||
@ -1677,6 +1678,7 @@ listVersions lt' criteria = do
|
|||||||
Nothing -> lr
|
Nothing -> lr
|
||||||
Just ListInstalled -> filter (\ListResult {..} -> lInstalled) lr
|
Just ListInstalled -> filter (\ListResult {..} -> lInstalled) lr
|
||||||
Just ListSet -> filter (\ListResult {..} -> lSet) lr
|
Just ListSet -> filter (\ListResult {..} -> lSet) lr
|
||||||
|
Just ListAvailable -> filter (\ListResult {..} -> not lNoBindist) lr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user