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
I'd like for there to be a way to delete templates using the CLI. We are managing our templates using a GitHub repository, and this poses some difficulty in maintaining the templates long term.
@tomek-ac I'm flexible in implementation but it'd be nice to be able to do something like postmark template -d template-name. Or adding this functionality to the API would be helpful as well.
My team was trying to set up a way to manage postmark templates in a repository using GitHub Actions and the Postmark CLI, but the only case we can't handle is if we want to delete a template.
@alicenstarI opened a PR herewhich includes a basic delete command, keep in mind it'll delete ALL templates as that's what I currently need for my use case but should be easy enough to tweak and allow deleting a single template by id/alias or a list of templates.
I was having too much fun with this one and improved the UX by allowing users to select whether they want to delete by id (one or multiple) or delete all templates. :)
Also added some extra check for delete all as it can be quite destructive.
$ ./dist/index.js templates delete
> ./dist/index.js templates delete
? Please enter your server token ••••••••••••••••••••••••••••••••••••
? Choose how you want to delete templates: Delete templates by id
? Enter template id(s) - separated by commas if multiple: 33336536, 33336535, 33336549
All finished! 3 templates have been deleted.
> ./dist/index.js templates delete
? Please enter your server token ••••••••••••••••••••••••••••••••••••
? Choose how you want to delete templates: Delete all templates
? Which template type do you want to delete? Templates
? Delete ALL templates? Are you sure? yes
? Enter "delete all templates" to confirm: delete all templates
All finished! 80 templates have been deleted.
@alicenstar what do you think? Would this work in your case? The proposed implementation seems to require providing the parameters interactively so it will probably not work in a hands-free GH action?
Activity
tomek-ac commentedon Aug 17, 2023
@alicenstar can you give us some more context? How would you like this to work?
alicenstar commentedon Sep 22, 2023
@tomek-ac I'm flexible in implementation but it'd be nice to be able to do something like
postmark template -d template-name. Or adding this functionality to the API would be helpful as well.alicenstar commentedon Sep 22, 2023
My team was trying to set up a way to manage postmark templates in a repository using GitHub Actions and the Postmark CLI, but the only case we can't handle is if we want to delete a template.
rlueder commentedon Sep 30, 2023
@alicenstar I opened a PR here
which includes a basic delete command, keep in mind it'll delete ALL templates as that's what I currently need for my use case but should be easy enough to tweak and allow deleting a single template by id/alias or a list of templates.I was having too much fun with this one and improved the UX by allowing users to select whether they want to delete by id (one or multiple) or delete all templates. :)
Also added some extra check for delete all as it can be quite destructive.
The underlying Postmark client already included a
deleteTemplatemethod so it was easy enough to expose to the CLI.To use it locally run:
then
tomek-ac commentedon Oct 2, 2023
@rlueder thanks for working on this!
@alicenstar what do you think? Would this work in your case? The proposed implementation seems to require providing the parameters interactively so it will probably not work in a hands-free GH action?