-
Notifications
You must be signed in to change notification settings - Fork 135
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
Reimplemented a common delete tink-cli command #433
Conversation
Signed-off-by: Gaurav Gahlot <[email protected]>
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.
I like where this is going!
cmd/tink-cli/cmd/delete/delete.go
Outdated
const longDescr = `Deletes one or many resources and prints the status of | ||
the deleted resource.` | ||
|
||
const exampleDescr = `# Delete template resource(s) |
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.
Here you should add a reference to deleting more than one ID.
tink hardware delete [id1] [id2][id3]
You can place an example of the output as well.
As part of the long description you can add an explanation about the output format and how you can pipe it with other commands like awk.
cmd/tink-cli/cmd/delete/delete.go
Outdated
_, err := opt.DeleteByID(cmd.Context(), opt.fullClient, requestedID) | ||
if err != nil { | ||
if s, ok := status.FromError(err); ok && s.Code() == codes.NotFound { | ||
fmt.Printf("Error\t%s\tnot found\n", requestedID) |
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.
You have to print to stderr cmd.Stderr
cmd/tink-cli/cmd/delete/delete.go
Outdated
return err | ||
} | ||
} | ||
fmt.Printf("Deleted\t%s\n", requestedID) |
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.
Print to cmd.Stdout
Codecov Report
@@ Coverage Diff @@
## master #433 +/- ##
==========================================
+ Coverage 34.34% 34.71% +0.37%
==========================================
Files 46 47 +1
Lines 2865 2892 +27
==========================================
+ Hits 984 1004 +20
- Misses 1794 1796 +2
- Partials 87 92 +5
Continue to review full report at Codecov.
|
89aff84
to
5621f84
Compare
Awesome work!!! Thanks |
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.
I forget :) the work is great but do you mind squashing commits?! Thanks
Signed-off-by: Gaurav Gahlot <[email protected]>
Signed-off-by: Gaurav Gahlot <[email protected]>
Signed-off-by: Gaurav Gahlot <[email protected]>
5621f84
to
86d5f24
Compare
Description
Why is this needed
Fixes: #425
How Has This Been Tested?
Checklist:
I have: