|
2 | 2 |
|
3 | 3 | A chiming clock for the command line, written in Go.
|
4 | 4 |
|
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +You can install `chimer` either from the latest release archive or be compiled locally. |
| 9 | + |
| 10 | +### From Release Archive |
| 11 | + |
| 12 | +1. Download the latest archive, specific to your platform, from https://github.com/codemedic/go-chimer/releases/latest |
| 13 | +2. Verify SHA256 |
| 14 | +3. Extract the archive; e.g. into `~/apps/chimer` |
| 15 | +4. That's it! |
| 16 | + |
| 17 | +### Compile |
| 18 | + |
| 19 | +1. Clone the repo |
| 20 | + ``` |
| 21 | + git clone https://github.com/codemedic/go-chimer.git |
| 22 | + ``` |
| 23 | +2. Build the binary |
| 24 | + ```shell |
| 25 | + # On Linux, dependencies for oto library need to be installed |
| 26 | + sudo apt install -y libasound2-dev build-essential |
| 27 | + |
| 28 | + cd go-chimer |
| 29 | + CGO_ENABLED=1 go build ./cmd/chimer/ |
| 30 | + ``` |
| 31 | +3. Copy binary and sounds |
| 32 | + ```shell |
| 33 | + mkdir -p ~/apps/chimer |
| 34 | + cp -r chimer chimes ~/apps/chimer |
| 35 | + ``` |
| 36 | + |
| 37 | +## Usage |
| 38 | + |
| 39 | +The `chimer` can be used either as a one-shot command run from a cron, every 15 minutes |
| 40 | +or as a continuously running service, from your service manager of choice. You may also |
| 41 | +run the binary directly from a terminal window. |
| 42 | + |
| 43 | +### Cron Usage |
| 44 | + |
| 45 | +You need to add the below line to your `crontab`. |
| 46 | + |
| 47 | +``` |
| 48 | +*/15 * * * * /home/username/apps/chimer/chimer --sound /home/username/apps/chimer/chimes` --cron |
| 49 | +``` |
| 50 | + |
| 51 | +### From a Terminal Window |
| 52 | + |
| 53 | +Run the command below from a terminal window; make sure you leave the window open afterwards. You may press `Ctrl+C` to stop `chimer`. |
| 54 | + |
| 55 | +```shell |
| 56 | +~/apps/chimer/chimer --sound ~/apps/chimer/chimes |
| 57 | +``` |
| 58 | + |
| 59 | +Alternatively, you may add the below line to your `.bashrc` or your shell's rc file to simplify the invocation. |
| 60 | + |
| 61 | +```shell |
| 62 | +export CHIMER_SOUND_DEFAULT="$HOME/apps/chimer/chimes" |
| 63 | +``` |
| 64 | + |
| 65 | +Then `chimer` can be invoked with no commandline option. |
| 66 | + |
| 67 | +```shell |
| 68 | +~/apps/chimer/chimer |
| 69 | +``` |
| 70 | + |
| 71 | +## Usage Help |
| 72 | + |
| 73 | +You can see the below usage help by using the command line option `--help`. |
| 74 | + |
| 75 | + $> ~/apps/chimer/chimer --help |
| 76 | + Usage: chimer [options] [arguments] |
| 77 | + |
| 78 | + OPTIONS |
| 79 | + --sound/$CHIMER_SOUND_DEFAULT <string> |
| 80 | + Default path for sound(s) if none are not specified. |
| 81 | + --sound-hour/$CHIMER_SOUND_HOUR <string> |
| 82 | + Path for sound(s) at zero past an hour. |
| 83 | + --sound-quarter-past/$CHIMER_SOUND_QUARTER_PAST <string> |
| 84 | + Path for sound(s) at quarter past an hour. |
| 85 | + --sound-half-past/$CHIMER_SOUND_HALF_PAST <string> |
| 86 | + Path for sound(s) at half past an hour. |
| 87 | + --sound-quarter-to/$CHIMER_SOUND_QUARTER_TO <string> |
| 88 | + Path for sound(s) at quarter to an hour. |
| 89 | + --cache-sounds/$CHIMER_CACHE_SOUNDS <bool> (default: true) |
| 90 | + Cache sounds in memory |
| 91 | + --repeat-hourly-sound/-r/$CHIMER_REPEAT_HOURLY_SOUND <bool> (default: false) |
| 92 | + Repeat the hourly sound T time at T'O clock. |
| 93 | + --minimum-volume-level/-l/$CHIMER_MINIMUM_VOLUME_LEVEL <int> (default: 50) |
| 94 | + --test-time/$CHIMER_TEST_TIME <value> |
| 95 | + Specify a time to test chimer in cron-mode. This option is ignored when cron-mode is not enabled. |
| 96 | + --cron/-c/$CHIMER_CRON_MODE_ENABLED <bool> (default: false) |
| 97 | + Enable cron-mode where it acts on the current time to decide whether to chime or not |
| 98 | + --help/-h |
| 99 | + display this help message |
| 100 | + --version/-v |
| 101 | + display version information |
| 102 | + |
| 103 | + NOTE: All sound paths can be either a relative or full path to an MP3 file or |
| 104 | + a directory containing multiple MP3s. In the latter case, one of the files will |
| 105 | + be chosen at random for each chime. |
0 commit comments