diff --git a/docs/_index.md b/docs/_index.md index 0837c86..1377110 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -74,5 +74,6 @@ poetry export --only test,docs * {{< option name="dev" deprecated=true >}}Include development dependencies.{{< /option >}} * `--extras (-E)`: Extra sets of dependencies to include. * `--all-extras`: Include all sets of extra dependencies. +* `--all-groups`: Include all dependency groups when exporting. * `--without-hashes`: Exclude hashes from the exported file. * `--with-credentials`: Include credentials for extra indices. diff --git a/src/poetry_plugin_export/command.py b/src/poetry_plugin_export/command.py index 67a43d0..ec97c5d 100644 --- a/src/poetry_plugin_export/command.py +++ b/src/poetry_plugin_export/command.py @@ -42,7 +42,7 @@ class ExportCommand(GroupCommand): "Include development dependencies. (Deprecated)", ), *GroupCommand._group_dependency_options(), - option("all-groups", None, "Include all sets of extra groups"), + option("all-groups", None, "Include all dependency groups"), option( "extras", "E", @@ -116,11 +116,15 @@ def handle(self) -> int: f"Extra [{', '.join(sorted(invalid_extras))}] is not specified." ) - if self.option("with") and self.option("all-groups"): + if ( + self.option("with") or self.option("without") or self.option("only") + ) and self.option("all-groups"): self.line_error( "You cannot specify explicit" - " `--with` while exporting" - " using `--all-groups`." + " `--with`, " + "`--without`, " + "or `--only` " + "while exporting using `--all-groups`." ) return 1 diff --git a/tests/command/test_command_export.py b/tests/command/test_command_export.py index c39af80..7efaee2 100644 --- a/tests/command/test_command_export.py +++ b/tests/command/test_command_export.py @@ -249,7 +249,23 @@ def test_with_conflicts_all_groups(tester: CommandTester, do_lock: None) -> None assert tester.status_code == 1 assert ( - "You cannot specify explicit `--with` while exporting using `--all-groups`.\n" + "You cannot specify explicit `--with`, `--without`, or `--only` while exporting using `--all-groups`.\n" + in tester.io.fetch_error() + ) + + tester.execute("--without=bar --all-groups") + + assert tester.status_code == 1 + assert ( + "You cannot specify explicit `--with`, `--without`, or `--only` while exporting using `--all-groups`.\n" + in tester.io.fetch_error() + ) + + tester.execute("--only=bar --all-groups") + + assert tester.status_code == 1 + assert ( + "You cannot specify explicit `--with`, `--without`, or `--only` while exporting using `--all-groups`.\n" in tester.io.fetch_error() )