You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same as we did for the get command #406 another one that we can migrate is the delete one.
Requirements:
Deprecate the current one with the right Cobra.Command flag as we did for the get command and use the same environment variable (if I remember well TINK_CLI_VERSION=0.0.0 to fall back to the old command)
The Delete command should be only one inside a new cmd/tink-cli/command/delete package and it should follow the same structure we have for get, and I mean Options if necessary for example
output: we do not need --format, let's print a line for every deleted ID, if an ID fails or does not exists print:
Error\t<id>\tnot found
In this way, the output can be parsed with awk for example.
6. The exit code is different than 0 (success) only if the client is not able to connect to the server otherwise it is a success (even if 2 out of 2 IDs do not exists or can't be deleted (like docker does))
Example:
template in the database:
* ID=1
* ID=23
# this should fail with exist code != 0 because at least 1 argument is required
$ tink template delete
# this succeed with exit code 0 if the server is up, even if the specified ID do not exists
$ tink template delete 1243 34 12
Error 1234 not found
Error 34 not found
Error 12 not found
# this succeed with exit code 0 if the server is up and it prints the id of the deleted resource
$ tink template delete 1 12
1
Error 12 not found
Yayyy
The text was updated successfully, but these errors were encountered:
## Description
```
# Delete template resource (success)
tink template delete 8ae1cc24-6a9c-11eb-a0fc-0242ac120005
Deleted 8ae1cc24-6a9c-11eb-a0fc-0242ac120005
# Delete template resource (not found)
tink template delete 8ae1cc24-6a9c-11eb-a0fc-0242ac120005
Error 8ae1cc24-6a9c-11eb-a0fc-0242ac120005 not found
# Delete template resources (one not found)
tink template delete 8ae1cc24-6a9c-11eb-a0fc-0242ac120005 e4115856-4358-429d-a8f6-9e1b7d794b72
Deleted 8ae1cc24-6a9c-11eb-a0fc-0242ac120005
Error e4115856-4358-429d-a8f6-9e1b7d794b72 not found
# Delete resources and exract resource ID with awk
tink template delete 8ae1cc24-6a9c-11eb-a0fc-0242ac120005 e4115856-4358-429d-a8f6-9e1b7d794b72 | awk {print $2} > result
cat result
8ae1cc24-6a9c-11eb-a0fc-0242ac120005
e4115856-4358-429d-a8f6-9e1b7d794b72
```
## Why is this needed
Fixes: #425
## How Has This Been Tested?
- Manual testing
- Unit tests
## Checklist:
I have:
- [x] updated the documentation and/or roadmap (if required)
- [x] added unit or e2e tests
- [ ] provided instructions on how to upgrade
Same as we did for the get command #406 another one that we can migrate is the
delete
one.Requirements:
get
command and use the same environment variable (if I remember well TINK_CLI_VERSION=0.0.0 to fall back to the old command)cmd/tink-cli/command/delete
package and it should follow the same structure we have forget
, and I meanOptions
if necessary for exampletink hardware|template|... delete <id1> <id2> <id3>
--format
, let's print a line for every deleted ID, if an ID fails or does not exists print:In this way, the output can be parsed with
awk
for example.6. The exit code is different than
0
(success) only if the client is not able to connect to the server otherwise it is a success (even if 2 out of 2 IDs do not exists or can't be deleted (like docker does))Example:
template in the database:
* ID=1
* ID=23
Yayyy
The text was updated successfully, but these errors were encountered: