Skip to content

Commit 2890574

Browse files
committed
Naive implementation
1 parent a3a8754 commit 2890574

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/Main.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ commandLineHandler currentDir progName isInterpreter = complicatedOptions
305305
addCommand' "unpack"
306306
"Unpack one or more packages locally"
307307
unpackCmd
308-
(some $ strArgument $ metavar "PACKAGE")
308+
((,) <$> (some $ strArgument $ metavar "PACKAGE")
309+
<*> (optional $ textOption $ long "to" <>
310+
help "Optional path to unpack the package into"))
309311
addCommand' "update"
310312
"Update the package index"
311313
updateCmd
@@ -647,10 +649,11 @@ uninstallCmd _ go = withConfigAndLock go $
647649
]
648650

649651
-- | Unpack packages to the filesystem
650-
unpackCmd :: [String] -> GlobalOpts -> IO ()
651-
unpackCmd names go = withConfigAndLock go $ do
652+
unpackCmd :: ([String], Maybe Text) -> GlobalOpts -> IO ()
653+
unpackCmd (names, Nothing) go = unpackCmd (names, Just ".") go
654+
unpackCmd (names, Just dstPath) go = withConfigAndLock go $ do
652655
mSnapshotDef <- mapM (makeConcreteResolver Nothing >=> loadResolver) (globalResolver go)
653-
Stack.Fetch.unpackPackages mSnapshotDef "." names
656+
Stack.Fetch.unpackPackages mSnapshotDef (T.unpack dstPath) names
654657

655658
-- | Update the package index
656659
updateCmd :: () -> GlobalOpts -> IO ()

0 commit comments

Comments
 (0)