@@ -42,6 +42,7 @@ class ExportCommand(GroupCommand):
4242 "Include development dependencies. (<warning>Deprecated</warning>)" ,
4343 ),
4444 * GroupCommand ._group_dependency_options (),
45+ option ("all-groups" , None , "Include all dependency groups" ),
4546 option (
4647 "extras" ,
4748 "E" ,
@@ -92,7 +93,6 @@ def handle(self) -> int:
9293 "</warning>"
9394 )
9495
95- # Checking extras
9696 if self .option ("extras" ) and self .option ("all-extras" ):
9797 self .line_error (
9898 "<error>You cannot specify explicit"
@@ -116,8 +116,26 @@ def handle(self) -> int:
116116 f"Extra [{ ', ' .join (sorted (invalid_extras ))} ] is not specified."
117117 )
118118
119+ if (
120+ self .option ("with" ) or self .option ("without" ) or self .option ("only" )
121+ ) and self .option ("all-groups" ):
122+ self .line_error (
123+ "<error>You cannot specify explicit"
124+ " `<fg=yellow;options=bold>--with</>`, "
125+ "`<fg=yellow;options=bold>--without</>`, "
126+ "or `<fg=yellow;options=bold>--only</>` "
127+ "while exporting using `<fg=yellow;options=bold>--all-groups</>`.</error>"
128+ )
129+ return 1
130+
131+ groups = (
132+ self .poetry .package .dependency_group_names (include_optional = True )
133+ if self .option ("all-groups" )
134+ else self .activated_groups
135+ )
136+
119137 exporter = Exporter (self .poetry , self .io )
120- exporter .only_groups (list (self . activated_groups ))
138+ exporter .only_groups (list (groups ))
121139 exporter .with_extras (list (extras ))
122140 exporter .with_hashes (not self .option ("without-hashes" ))
123141 exporter .with_credentials (self .option ("with-credentials" ))
0 commit comments