krontab icon indicating copy to clipboard operation
krontab copied to clipboard

Creating a template should read from stdin

Open jacobtomlinson opened this issue 5 years ago • 1 comments

A nice feature would be for template creation to read from stdin. Currently when you run krontab create template <name> a blank template file will be opened in a text editor.

It would be nice if we could pipe some text into that command to give us a starting point. For example we could effectively duplicate the default template by running

krontab get template default | krontab create template <new template>

This would open the new template for editing but the file would be already populated with the contents of the default template.

We could also include a flag to skip the interactive part which would allow a one line duplication. We should also think about what happens if the user exits from the test editor without saving, should it create the new template or not?

jacobtomlinson avatar Mar 04 '19 11:03 jacobtomlinson

Might be helpful https://flaviocopes.com/go-shell-pipes/

jacobtomlinson avatar Mar 04 '19 11:03 jacobtomlinson