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
1cc68780
Commit
1cc68780
authored
Aug 05, 2012
by
refold
Browse files
Allow invoking 'hc-pkg init' via D.S.Program.HcPkg.
parent
30d67737
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Program/HcPkg.hs
View file @
1cc68780
...
...
@@ -10,6 +10,7 @@
-- Currently only GHC and LHC have hc-pkg programs.
module
Distribution.Simple.Program.HcPkg
(
init
,
register
,
reregister
,
unregister
,
...
...
@@ -18,6 +19,7 @@ module Distribution.Simple.Program.HcPkg (
dump
,
-- * Program invocations
initInvocation
,
registerInvocation
,
reregisterInvocation
,
unregisterInvocation
,
...
...
@@ -26,6 +28,7 @@ module Distribution.Simple.Program.HcPkg (
dumpInvocation
,
)
where
import
Prelude
hiding
(
init
)
import
Distribution.Package
(
PackageId
,
InstalledPackageId
(
..
)
)
import
Distribution.InstalledPackageInfo
...
...
@@ -62,6 +65,15 @@ import System.FilePath as FilePath
import
qualified
System.FilePath.Posix
as
FilePath.Posix
-- | Call @hc-pkg@ to initialise a package database at the location {path}.
--
-- > hc-pkg init {path}
--
init
::
Verbosity
->
ConfiguredProgram
->
FilePath
->
IO
()
init
verbosity
hcPkg
path
=
runProgramInvocation
verbosity
(
initInvocation
hcPkg
verbosity
path
)
-- | Call @hc-pkg@ to register a package.
--
-- > hc-pkg register {filename | -} [--user | --global | --package-db]
...
...
@@ -228,6 +240,14 @@ setInstalledPackageId pkginfo = pkginfo
-- The program invocations
--
initInvocation
::
ConfiguredProgram
->
Verbosity
->
FilePath
->
ProgramInvocation
initInvocation
hcPkg
verbosity
path
=
programInvocation
hcPkg
args
where
args
=
[
"init"
,
path
]
++
verbosityOpts
hcPkg
verbosity
registerInvocation
,
reregisterInvocation
::
ConfiguredProgram
->
Verbosity
->
PackageDBStack
->
Either
FilePath
InstalledPackageInfo
...
...
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