This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Description
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
- Tests, tests, tests
- UX:
tink hardware|template|... delete <id1> <id2> <id3>
- output: we do not need
--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
# 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