Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
68deddde
Commit
68deddde
authored
Dec 04, 2013
by
Mikhail Glushenkov
Browse files
Merge pull request #1599 from wdanilo/master
Refactoring: extracting 'List.getPkgList' function out of 'List.list'
parents
1d8ae56f
a682875c
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/List.hs
View file @
68deddde
...
...
@@ -70,17 +70,16 @@ import System.Directory
(
doesDirectoryExist
)
-- |Show information about packages
list
::
Verbosity
->
PackageDBStack
->
[
Repo
]
->
Compiler
->
ProgramConfiguration
->
ListFlags
->
[
String
]
->
IO
()
list
verbosity
packageDBs
repos
comp
conf
listFlags
pats
=
do
-- |Returns list of packages matching a search strings
getPkgList
::
Verbosity
->
PackageDBStack
->
[
Repo
]
->
Compiler
->
ProgramConfiguration
->
ListFlags
->
[
String
]
->
IO
[
PackageDisplayInfo
]
getPkgList
verbosity
packageDBs
repos
comp
conf
listFlags
pats
=
do
installedPkgIndex
<-
getInstalledPackages
verbosity
comp
packageDBs
conf
sourcePkgDb
<-
getSourcePackages
verbosity
repos
let
sourcePkgIndex
=
packageIndex
sourcePkgDb
...
...
@@ -104,6 +103,26 @@ list verbosity packageDBs repos comp conf listFlags pats = do
,
not
onlyInstalled
||
not
(
null
installedPkgs
)
,
let
pref
=
prefs
pkgname
selectedPkg
=
latestWithPref
pref
sourcePkgs
]
return
matches
where
onlyInstalled
=
fromFlag
(
listInstalled
listFlags
)
matchingPackages
search
index
=
[
pkg
|
pat
<-
pats
,
pkg
<-
search
index
pat
]
-- |Show information about packages
list
::
Verbosity
->
PackageDBStack
->
[
Repo
]
->
Compiler
->
ProgramConfiguration
->
ListFlags
->
[
String
]
->
IO
()
list
verbosity
packageDBs
repos
comp
conf
listFlags
pats
=
do
matches
<-
getPkgList
verbosity
packageDBs
repos
comp
conf
listFlags
pats
if
simpleOutput
then
putStr
$
unlines
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment