@@ -35,7 +35,8 @@ type artifactRow struct {
35
35
}
36
36
37
37
type options struct {
38
- group string
38
+ group string
39
+ allGroups bool
39
40
40
41
registryID string
41
42
outputFormat string
@@ -95,6 +96,7 @@ func NewListCommand(f *factory.Factory) *cobra.Command {
95
96
}
96
97
97
98
cmd .Flags ().StringVarP (& opts .group , "group" , "g" , registrycmdutil .DefaultArtifactGroup , opts .localizer .MustLocalize ("artifact.common.group" ))
99
+ cmd .Flags ().BoolVarP (& opts .allGroups , "all-groups" , "a" , false , opts .localizer .MustLocalize ("artifact.cmd.list.flag.allgroups.description" ))
98
100
cmd .Flags ().Int32VarP (& opts .page , "page" , "" , 1 , opts .localizer .MustLocalize ("artifact.common.page.number" ))
99
101
cmd .Flags ().Int32VarP (& opts .limit , "limit" , "" , 100 , opts .localizer .MustLocalize ("artifact.common.page.limit" ))
100
102
@@ -112,7 +114,7 @@ func NewListCommand(f *factory.Factory) *cobra.Command {
112
114
}
113
115
114
116
func runList (opts * options ) error {
115
- if opts .group == registrycmdutil .DefaultArtifactGroup {
117
+ if opts .group == registrycmdutil .DefaultArtifactGroup && ! opts . allGroups {
116
118
opts .Logger .Info (opts .localizer .MustLocalize ("registry.artifact.common.message.no.group" , localize .NewEntry ("DefaultArtifactGroup" , registrycmdutil .DefaultArtifactGroup )))
117
119
}
118
120
@@ -129,12 +131,15 @@ func runList(opts *options) error {
129
131
}
130
132
request := a .SearchApi .SearchArtifacts (opts .Context )
131
133
132
- request = request .Group (opts .group )
133
134
request = request .Offset ((opts .page - 1 ) * opts .limit )
134
135
request = request .Limit (opts .limit )
135
136
request = request .Orderby (registryinstanceclient .SORTBY_CREATED_ON )
136
137
request = request .Order (registryinstanceclient .SORTORDER_ASC )
137
138
139
+ if ! opts .allGroups {
140
+ request = request .Group (opts .group )
141
+ }
142
+
138
143
if opts .name != "" {
139
144
request = request .Name (opts .name )
140
145
}
0 commit comments