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

Reimplement a common delete tink-cli command #425

@gianarb

Description

@gianarb

Same as we did for the get command #406 another one that we can migrate is the delete one.

Requirements:

  1. 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)
  2. 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
  3. Tests, tests, tests
  4. UX: tink hardware|template|... delete <id1> <id2> <id3>
  5. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions