From b7a41d15ea09acc2705de48ff0234b16143824d9 Mon Sep 17 00:00:00 2001 From: Kate Date: Sat, 30 Nov 2024 10:57:30 +0000 Subject: [PATCH] Fix opam switch list-available when given several arguments --- master_changes.md | 1 + src/client/opamCommands.ml | 4 ++-- tests/reftests/switch-list-available.test | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/master_changes.md b/master_changes.md index 64d2b77cc2e..b877daed335 100644 --- a/master_changes.md +++ b/master_changes.md @@ -39,6 +39,7 @@ users) ## Switch * [BUG] Fix `opam switch remove ` failure when it is a linked switch [#6276 @btjorge - fix #6275] + * Fix `opam switch list-available` when given several arguments [#6318 @kit-ty-kate] ## Config diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml index 1d1266926fe..83f15c3f1b4 100644 --- a/src/client/opamCommands.ml +++ b/src/client/opamCommands.ml @@ -2904,7 +2904,7 @@ let switch cli = in let all_compilers = OpamListCommand.filter ~base:compilers st - (OpamFormula.ands (List.map (fun f -> OpamFormula.Atom f) filters)) + (OpamFormula.ors (List.map (fun f -> OpamFormula.Atom f) filters)) in let compilers = if all then @@ -3199,7 +3199,7 @@ let pin_doc = "Pin a given package to a specific version or source." let pin ?(unpin_only=false) cli = let doc = pin_doc in let commands = [ - cli_original, "list", `list, [], + cli_original, "list", `list, [], "Lists pinned packages. \ If the source is a remote repository, \ displays the hash representing its state."; diff --git a/tests/reftests/switch-list-available.test b/tests/reftests/switch-list-available.test index bedc168df16..cd0860fe625 100644 --- a/tests/reftests/switch-list-available.test +++ b/tests/reftests/switch-list-available.test @@ -152,4 +152,12 @@ comp_c 2 ### : show the behaviour of list-available with several arguments ### opam switch list-available "comp-*" "comp_*" # Listing available compilers from repositories: default -# No matches found +# Name # Version # Synopsis +comp-a 1 +comp-b 1 +comp_c 1 +comp-a 2 +comp-a 3 +comp-a 4 +comp-b 4 +[NOTE] Some compilers have been hidden (e.g. pre-releases). If you want to display them, run: 'opam switch list-available --all'