Skip to content

Commit

Permalink
Show packages when no --project-file is given
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Dec 28, 2024
1 parent 075f9e0 commit 8999884
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cabal-install/src/Distribution/Client/CmdRepl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ import System.FilePath
, (</>)
)
import Text.PrettyPrint hiding ((<>))
import qualified Text.PrettyPrint as Pretty

replCommand :: CommandUI (NixStyleFlags ReplFlags)
replCommand =
Expand Down Expand Up @@ -297,14 +298,15 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g
when (null targetStrings) $
let pkgs = projectPackages $ projectConfig ctx
intro = text "With a project, the REPL command requires a target."
msg = case projectConfigProjectFile . projectConfigShared $ projectConfig ctx of
Flag project ->
intro
<+> (text "The packages in this project" <> comma)
<+> (quotes (text project) <> comma)
<+> text "are:"
$+$ (nest 1 $ vcat [text "-" <+> text pkg | pkg <- sort pkgs])
_ -> intro
project = case projectConfigProjectFile . projectConfigShared $ projectConfig ctx of
Flag projectName -> comma <+> (quotes (text projectName) <> comma)
_ -> Pretty.empty
msg =
intro
<+> text "The packages in this project"
<+> project
<+> text "are:"

Check warning on line 308 in cabal-install/src/Distribution/Client/CmdRepl.hs

View workflow job for this annotation

GitHub Actions / hlint

Suggestion in replAction in module Distribution.Client.CmdRepl: Move brackets to avoid $ ▫︎ Found: "text \"are:\"\n $+$ (nest 1 $ vcat [text \"-\" <+> text pkg | pkg <- sort pkgs])" ▫︎ Perhaps: "text \"are:\"\n $+$ nest 1 (vcat [text \"-\" <+> text pkg | pkg <- sort pkgs])"
$+$ (nest 1 $ vcat [text "-" <+> text pkg | pkg <- sort pkgs])
in dieWithException verbosity $ RenderReplTargetProblem [render msg]
return ctx
GlobalContext -> do
Expand Down

0 comments on commit 8999884

Please sign in to comment.