diff --git a/cmd/root.go b/cmd/root.go index 8a11e68..69eed05 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -25,7 +25,7 @@ import ( "github.com/spf13/viper" ) -var Version string = "33.15" +var Version string = "33.16" var cfgFile string var userAgent string diff --git a/docs/releases/33.16.md b/docs/releases/33.16.md new file mode 100644 index 0000000..eb9c4f1 --- /dev/null +++ b/docs/releases/33.16.md @@ -0,0 +1,16 @@ +## What's new + +### `cronitor sync --auto` no longer installs an empty crontab when the API fails + +Fixes for 33.15 ([#93](https://github.com/cronitorio/cronitor-cli/pull/93)): + +- With `--auto` and a single crontab file, if the Cronitor API call fails, sync now prints the original crontab to stdout, leaves the file unchanged, and exits 1. Before, it printed nothing, so `cronitor sync --auto file | crontab -` installed an empty crontab. +- The same applies once sync has read the file and then hits a missing API key, an invalid `--format`, or a file it can't write. It prints the original crontab and exits 1. +- A crontab file that is missing or can't be read now exits 1, with the error on stderr and nothing on stdout. Before, it exited 0. `--dry-run` on a single named file that can't be written also exits 1. +- `--verbose` request logs go to stderr when stdout carries the crontab, so they can't end up in the pipe. +- With several crontabs, or in interactive mode, an API failure no longer stops the run. Each remaining crontab is still tried, and sync exits 1 at the end. +- A direct `| crontab -` pipe can still install an empty crontab if sync fails before it reads the file, for example when the file is missing or a flag is invalid. Capture the output first: `out=$(cronitor sync --auto file) && printf '%s\n' "$out" | crontab -`. Don't add `--silent` to that command, because `--auto --silent` prints no crontab. + +### Other changes + +- The reminder after an interactive dry run now tells you to run the same command without `--dry-run`. Before, it suggested `--auto --silent`. API keys passed with `-k`/`--api-key` or `-p`/`--ping-api-key` are hidden in that reminder.