Skip to content

Commit 40591fd

Browse files
committed
chore: fix review findings
1 parent 178de37 commit 40591fd

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

internal/cmd/beta/image/create/create.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const (
4848

4949
minDiskSizeFlag = "min-disk-size"
5050
minRamFlag = "min-ram"
51-
ownerFlag = "owner"
5251
protectedFlag = "protected"
5352
)
5453

@@ -90,12 +89,12 @@ func NewCmd(p *print.Printer) *cobra.Command {
9089
Args: args.NoArgs,
9190
Example: examples.Build(
9291
examples.NewExample(
93-
`Create a named image 'my-new-image' from a raw disk image located in '/my/raw/image'`,
92+
`Create an image with name 'my-new-image' from a raw disk image located in '/my/raw/image'`,
9493
`$ stackit beta image create --name my-new-image --disk-format=raw --local-file-path=/my/raw/image`,
9594
),
9695
examples.NewExample(
97-
`Create a named image 'my-new-image' from a qcow2 image read from '/my/qcow2/image' with labels describing its contents`,
98-
`$ stackit beta image create --name my-new-image --disk-format=qcow2 --local-file-path=/my/qcow2/image--labels os=linux,distro=alpine,version=3.12`,
96+
`Create an image with name 'my-new-image' from a qcow2 image read from '/my/qcow2/image' with labels describing its contents`,
97+
`$ stackit beta image create --name my-new-image --disk-format=qcow2 --local-file-path=/my/qcow2/image --labels os=linux,distro=alpine,version=3.12`,
9998
),
10099
),
101100
RunE: func(cmd *cobra.Command, _ []string) (err error) {
@@ -173,12 +172,12 @@ func uploadAsync(ctx context.Context, p *print.Printer, model *inputModel, file
173172
go func() {
174173
ticker := time.NewTicker(2 * time.Second)
175174
var uploaded int
176-
done:
175+
done:
177176
for {
178177
select {
179178
case <-ticker.C:
180-
p.Info("uploaded %3.1f%%\n", 100.0/float64(stat.Size())*float64(uploaded))
181-
case n,ok := <-ch:
179+
p.Info("uploaded %3.1f%%\r", 100.0/float64(stat.Size())*float64(uploaded))
180+
case n, ok := <-ch:
182181
if !ok {
183182
break done
184183
}
@@ -204,7 +203,7 @@ type progressReader struct {
204203
ch chan int
205204
}
206205

207-
func newProgressReader(delegate io.Reader) (io.Reader, <-chan int) {
206+
func newProgressReader(delegate io.Reader) (reader io.Reader, result <-chan int) {
208207
ch := make(chan int)
209208
return &progressReader{
210209
delegate: delegate,

internal/cmd/beta/image/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
5454

5555
imageName, err := iaasUtils.GetImageName(ctx, apiClient, model.ProjectId, model.ImageId)
5656
if err != nil {
57-
p.Warn("get image name: %v", err)
57+
p.Debug(print.ErrorLevel, "get image name: %v", err)
5858
imageName = model.ImageId
5959
}
6060

internal/cmd/beta/image/update/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
112112
Args: args.SingleArg(imageIdArg, utils.ValidateUUID),
113113
Example: examples.Build(
114114
examples.NewExample(`Update the name of an image with ID "xxx"`, `$ stackit beta image update xxx --name my-new-name`),
115-
examples.NewExample(`Update the labels of image "xxx"`, `$ stackit beta image update xxx --labels label1=value1,label2=value2`),
115+
examples.NewExample(`Update the labels of an image with ID "xxx"`, `$ stackit beta image update xxx --labels label1=value1,label2=value2`),
116116
),
117117
RunE: func(cmd *cobra.Command, args []string) error {
118118
ctx := context.Background()
@@ -135,7 +135,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
135135

136136
imageLabel, err := iaasUtils.GetImageName(ctx, apiClient, model.ProjectId, model.Id)
137137
if err != nil {
138-
p.Warn("cannot retrieve image name: %v", err)
138+
p.Debug(print.WarningLevel, "cannot retrieve image name: %v", err)
139139
imageLabel = model.Id
140140
}
141141

0 commit comments

Comments
 (0)