Navigator Prefabricating Marinates
Miss any of our Open RFC calls?Watch the recordings here! »

cli-countdown

1.0.0 • Public • Published

cli-countdown

Counts down a number of seconds before exiting. This is useful as an alternative to read, to give users a chance to exit multi-part shell scripts.

npm install -g cli-countdown

Usage

echo Doing interesting things...
echo Now about to delete some files
countdown -m "Deleting files in" -s 10
rm foo.txt

Which displays

screenshot

  • If the timer runs to the end, the exit code will be 0
  • If the user interrupts with Ctrl-C (SIGINT), the exit code will be 1

If you want Ctrl-C to abort the current shell script completely, you will probably want to use

  • set -e at the top of your script
  • or countdown <args> || exit 1

Arguments

  • countdown -s 10: timer duration in seconds (default 10)
  • countdown -m "message": message to display (default none)

Install

npm i cli-countdown

DownloadsWeekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar