Skip to content

Commit

Permalink
Show the number of matches found matching query
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Jan 4, 2025
1 parent 9558495 commit 81003c3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cabal-install/src/Distribution/Client/CmdTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ targetAction flags@NixStyleFlags{..} ts globalFlags = do
Nothing
targetSelectors

printTargetForms verbosity targets elaboratedPlan
printTargetForms verbosity targetStrings targets elaboratedPlan
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
targetStrings = if null ts then ["all"] else ts
Expand All @@ -183,14 +183,21 @@ targetAction flags@NixStyleFlags{..} ts globalFlags = do
reportBuildTargetProblems :: Verbosity -> [TargetProblem'] -> IO a
reportBuildTargetProblems verbosity = reportTargetProblems verbosity "target"

printTargetForms :: Verbosity -> TargetsMap -> ElaboratedInstallPlan -> IO ()
printTargetForms verbosity targets elaboratedPlan =
printTargetForms :: Verbosity -> [String] -> TargetsMap -> ElaboratedInstallPlan -> IO ()
printTargetForms verbosity targetStrings targets elaboratedPlan =
noticeDoc verbosity $
vcat
[ text "Fully qualified target forms" Pretty.<> colon
, nest 1 $ vcat [text "-" <+> text tf | tf <- targetForms]
, found
]
where
found =
let n = length targetStrings
t = if n == 1 then "target" else "targets"
query = intercalate ", " targetStrings
in text "Found" <+> int n <+> text t <+> text "matching" <+> text query Pretty.<> char '.'

localPkgs =
[x | Configured x@ElaboratedConfiguredPackage{elabLocalToProject = True} <- InstallPlan.toList elaboratedPlan]

Expand Down

0 comments on commit 81003c3

Please sign in to comment.