unpackCmd :: [String] -> GlobalOpts -> IO ()
unpackCmd names go = withConfigAndLock go $ do
    menv <- getMinimalEnvOverride
    mMiniBuildPlan <-
        case globalResolver go of
            Nothing -> return Nothing
            Just ar -> fmap Just $ do
                r <- makeConcreteResolver ar
                case r of
                    ResolverSnapshot snapName -> do
                        config <- view configL
                        miniConfig <- loadMiniConfig config
                        runInnerStackT miniConfig (loadMiniBuildPlan snapName)
                    ResolverCompiler _ -> error "unpack does not work with compiler resolvers"
                    ResolverCustom _ _ -> error "unpack does not work with custom resolvers"
    Stack.Fetch.unpackPackages menv mMiniBuildPlan "." names

-- | Update the package index
unpackCmd :: [String] -> GlobalOpts -> IO ()
unpackCmd names go = withConfigAndLock go $ do
    menv <- getMinimalEnvOverride
    mMiniBuildPlan <-
        case globalResolver go of
            Nothing -> return Nothing
            Just ar -> fmap Just $ do
                r <- makeConcreteResolver ar
                case r of
                    ResolverSnapshot snapName -> do
                        config <- view configL
                        miniConfig <- loadMiniConfig config
                        runInnerStackT miniConfig (loadMiniBuildPlan snapName)
                    ResolverCompiler _ -> error "unpack does not work with compiler resolvers"
                    ResolverCustom _ _ -> error "unpack does not work with custom resolvers"
    Stack.Fetch.unpackPackages menv mMiniBuildPlan "." names

-- | Update the package index
unpackCmd names go = withConfigAndLock go $ do
    menv <- getMinimalEnvOverride
    mMiniBuildPlan <-
        case globalResolver go of
            Nothing -> return Nothing
            Just ar -> fmap Just $ do
                r <- makeConcreteResolver ar
                case r of
                    ResolverSnapshot snapName -> do
                        config <- view configL
                        miniConfig <- loadMiniConfig config
                        runInnerStackT miniConfig (loadMiniBuildPlan snapName)
                    ResolverCompiler _ -> error "unpack does not work with compiler resolvers"
                    ResolverCustom _ _ -> error "unpack does not work with custom resolvers"
    Stack.Fetch.unpackPackages menv mMiniBuildPlan "." names

-- | Update the package index