-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added test cases for Delete #8
Conversation
…rs/kotewar/error-handling-and-tests
…rs/kotewar/error-handling-and-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -44,30 +49,46 @@ func NewCmdDelete() *cobra.Command { | |||
if !f.Confirm { | |||
matchedCaches, err := getCacheListWithExactMatch(f, artifactCache) | |||
if err != nil { | |||
return err | |||
var httpError api.HTTPError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error handling is exactly same with list.go so abstract this out to a separate function
f.Confirm = choice == "Delete" | ||
fmt.Println() | ||
} | ||
if f.Confirm { | ||
cachesDeleted, err := artifactCache.DeleteCaches(queryParams) | ||
if err != nil { | ||
return err | ||
var httpError api.HTTPError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be handled using the same error handling function proposed above.
Merging this now and expect another PR to resolve comments. This is being done to not overload this PR and also close the long running PR. |
sizeWidth := SIZE_COLUMN_WIDTH // hard-coded size as the content is scoped | ||
timeWidth := LAST_ACCESSED_AT_COLUMN_WIDTH // hard-coded size as the content is scoped | ||
keyWidth := int(math.Floor(0.75 * (width - 15 - 20))) | ||
refWidth := int(math.Floor(0.25 * (width - 15 - 20))) | ||
keyWidth := int(math.Floor(0.65 * float64(width-15-20))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use consts SIZE_COLUMN_WIDTH
and LAST_ACCESSED_AT_COLUMN_WIDTH
instead of hard-coded values. I missed it in my PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
Overview
Changes
delete.go
Pending items
confirm
flag