Skip to content

Commit fd65ace

Browse files
committed
fix: minor review suggestions
1 parent 7099367 commit fd65ace

5 files changed

Lines changed: 9 additions & 15 deletions

File tree

pkg/cmd/registry/artifact/crud/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func confirmDelete(opts *Options, message string) error {
180180
}
181181

182182
if !shouldContinue {
183-
return errors.New("")
183+
return errors.New("command stopped by user")
184184
}
185185
}
186186
return nil

pkg/cmd/registry/artifact/crud/list/list.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ rhoas service-registry artifact list --page=2 --limit=10
121121
cmd.Flags().Int32VarP(&opts.limit, "limit", "", 100, "Page limit")
122122

123123
cmd.Flags().StringVarP(&opts.registryID, "instance-id", "", "", "Id of the registry to be used. By default uses currently selected registry")
124-
cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", "Output format (json, yaml, yml, table)")
124+
cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", "Output format (json, yaml, yml)")
125125

126126
flagutil.EnableOutputFlagCompletion(cmd)
127127

@@ -162,12 +162,6 @@ func runList(opts *Options) error {
162162
return registryinstanceerror.TransformError(err)
163163
}
164164

165-
totalCount := opts.page * opts.limit
166-
if len(response.Artifacts) != 0 && response.GetCount() < totalCount {
167-
logger.Info("Provided limit and page arguments are larger than total count of elements on the server", response.GetCount())
168-
return nil
169-
}
170-
171165
if len(response.Artifacts) == 0 && opts.outputFormat == "" {
172166
logger.Info("No artifacts available for " + opts.group + " group and registry id " + opts.registryID)
173167
return nil
@@ -181,19 +175,19 @@ func runList(opts *Options) error {
181175
data, _ := yaml.Marshal(response)
182176
_ = dump.YAML(opts.IO.Out, data)
183177
default:
184-
rows := mapResponseItemsToRows(&response.Artifacts)
178+
rows := mapResponseItemsToRows(response.Artifacts)
185179
dump.Table(opts.IO.Out, rows)
186180
logger.Info("")
187181
}
188182

189183
return nil
190184
}
191185

192-
func mapResponseItemsToRows(artifacts *[]registryinstanceclient.SearchedArtifact) []artifactRow {
186+
func mapResponseItemsToRows(artifacts []registryinstanceclient.SearchedArtifact) []artifactRow {
193187
rows := []artifactRow{}
194188

195-
for i := range *artifacts {
196-
k := (*artifacts)[i]
189+
for i := range artifacts {
190+
k := (artifacts)[i]
197191
row := artifactRow{
198192
Id: k.GetId(),
199193
Name: k.GetName(),

pkg/cmd/registry/artifact/crud/update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func runUpdate(opts *Options) error {
132132
}
133133

134134
if opts.group == "" {
135-
logger.Info("Group was not specified. Using " + util.DefaultArtifactGroup + " artifacts group.")
135+
logger.Info("Group was not specified. Using", util.DefaultArtifactGroup, "artifacts group.")
136136
opts.group = util.DefaultArtifactGroup
137137
}
138138

pkg/cmd/registry/artifact/download/download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func runGet(opts *Options) error {
147147
request := dataAPI.ArtifactsApi.GetContentByHash(ctx, opts.hash)
148148
dataFile, _, err = request.Execute()
149149
} else {
150-
return errors.New("Please specify at least one flag: [contentId, globalId, hash]")
150+
return errors.New("please specify at least one flag: [contentId, global-id, hash]")
151151
}
152152

153153
if err != nil {

pkg/cmd/registry/artifact/util/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strings"
55
)
66

7-
var DefaultArtifactGroup = "default"
7+
const DefaultArtifactGroup = "default"
88

99
var AllowedArtifactTypeEnumValues = []string{
1010
"AVRO",

0 commit comments

Comments
 (0)