Skip to content

Commit

Permalink
Only show the note about hidden packages if there are hidden packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Aug 8, 2024
1 parent 90046e3 commit fba30f9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/client/opamCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2880,17 +2880,19 @@ let switch cli =
patt))
pattlist
in
let formula =
let base_formula = List.map (fun f -> OpamFormula.Atom f) filters in
if all then
base_formula
else
OpamFormula.Atom (OpamListCommand.NotFlag Pkgflag_AvoidVersion)
:: OpamFormula.Atom (OpamListCommand.NotFlag Pkgflag_Deprecated)
:: base_formula
let all_compilers =
OpamListCommand.filter ~base:compilers st
(OpamFormula.ands (List.map (fun f -> OpamFormula.Atom f) filters))
in
let compilers =
OpamListCommand.filter ~base:compilers st (OpamFormula.ands formula)
if all then
all_compilers
else
OpamListCommand.filter ~base:all_compilers st
(OpamFormula.ands [
OpamFormula.Atom (OpamListCommand.NotFlag Pkgflag_AvoidVersion);
OpamFormula.Atom (OpamListCommand.NotFlag Pkgflag_Deprecated);
])
in
let format =
if print_short then OpamListCommand.([ Package ])
Expand All @@ -2911,7 +2913,7 @@ let switch cli =
order = `Custom order;
}
compilers;
if not all then
if not all && not (OpamPackage.Set.equal all_compilers compilers) then
OpamConsole.note
"Some compilers may have been hidden (e.g. pre-releases). \
If you want to display them, run: 'opam switch list-available --all'";
Expand Down

0 comments on commit fba30f9

Please sign in to comment.