Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve ux for list args #15781

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conan/cli/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ def list(conan_api: ConanAPI, parser, *args):
pkglist = MultiPackagesList.load_graph(graphfile, args.graph_recipes, args.graph_binaries)
else:
ref_pattern = ListPattern(args.pattern, rrev=None, prev=None)
if not ref_pattern.package_id and (args.package_query or args.filter_profile or
args.filter_settings or args.filter_options):
raise ConanException("--package-query and --filter-xxx can only be done for binaries, "
"a 'pkgname/version:*' pattern is necessary")
# If neither remote nor cache are defined, show results only from cache
pkglist = MultiPackagesList()
if args.cache or not args.remote:
Expand Down
3 changes: 3 additions & 0 deletions conans/test/integration/command_v2/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def test_query_param_is_required(self):
c.run("list * --graph-recipes=x", assert_error=True)
assert "ERROR: --graph-recipes and --graph-binaries require a --graph input" in c.out

c.run("list * -p os=Linux", assert_error=True)
assert "--package-query and --filter-xxx can only be done for binaries" in c.out


@pytest.fixture(scope="module")
def client():
Expand Down