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

use * as default for conan list when no args #17300

Merged
merged 1 commit into from
Nov 11, 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
2 changes: 1 addition & 1 deletion conan/cli/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def list(conan_api: ConanAPI, parser, *args):
args = parser.parse_args(*args)

if args.pattern is None and args.graph is None:
raise ConanException("Missing pattern or graph json file")
args.pattern = "*" # All packages
if args.graph: # a few arguments are not compatible with this
if args.pattern:
raise ConanException("Cannot define both the pattern and the graph json file")
Expand Down
16 changes: 9 additions & 7 deletions test/integration/command_v2/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@

class TestParamErrors:

def test_query_param_is_required(self):
def test_default_pattern(self):
c = TestClient()
c.run("list", assert_error=True)
assert "ERROR: Missing pattern or graph json file" in c.out
c.run("list")
assert "Found 0 pkg/version" in c.out

c.run("list -c", assert_error=True)
assert "ERROR: Missing pattern or graph json file" in c.out
c.run("list -c")
assert "Found 0 pkg/version" in c.out

c.run('list -r="*"', assert_error=True)
assert "ERROR: Missing pattern or graph json file" in c.out
assert "ERROR: Remotes for pattern '*' can't be found" in c.out

c.run("list --remote remote1 --cache", assert_error=True)
assert "ERROR: Missing pattern or graph json file" in c.out
assert "ERROR: Remote 'remote1' can't be found or is disabled" in c.out

def test_query_param(self):
c = TestClient()
c.run("list * --graph=myjson", assert_error=True)
assert "ERROR: Cannot define both the pattern and the graph json file" in c.out

Expand Down