Skip to content

Commit

Permalink
Update docs and disable macOS build since it is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
codemedic committed Sep 29, 2022
1 parent 8a87c22 commit 286b487
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
goos: [linux, windows, darwin]
goarch: [amd64]
exclude:
- goarch: arm64
goos: windows
- goarch: amd64
goos: darwin
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.32
Expand Down
101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,104 @@

A chiming clock for the command line, written in Go.


## Installation

You can install `chimer` either from the latest release archive or be compiled locally.

### From Release Archive

1. Download the latest archive, specific to your platform, from https://github.com/codemedic/go-chimer/releases/latest
2. Verify SHA256
3. Extract the archive; e.g. into `~/apps/chimer`
4. That's it!

### Compile

1. Clone the repo
```
git clone https://github.com/codemedic/go-chimer.git
```
2. Build the binary
```shell
# On Linux, dependencies for oto library need to be installed
sudo apt install -y libasound2-dev build-essential

cd go-chimer
CGO_ENABLED=1 go build ./cmd/chimer/
```
3. Copy binary and sounds
```shell
mkdir -p ~/apps/chimer
cp -r chimer chimes ~/apps/chimer
```

## Usage

The `chimer` can be used either as a one-shot command run from a cron, every 15 minutes
or as a continuously running service, from your service manager of choice. You may also
run the binary directly from a terminal window.

### Cron Usage

You need to add the below line to your `crontab`.

```
*/15 * * * * /home/username/apps/chimer/chimer --sound /home/username/apps/chimer/chimes` --cron
```

### From a Terminal Window

Run the command below from a terminal window; make sure you leave the window open afterwards. You may press `Ctrl+C` to stop `chimer`.

```shell
~/apps/chimer/chimer --sound ~/apps/chimer/chimes
```

Alternatively, you may add the below line to your `.bashrc` or your shell's rc file to simplify the invocation.

```shell
export CHIMER_SOUND_DEFAULT="$HOME/apps/chimer/chimes"
```

Then `chimer` can be invoked with no commandline option.

```shell
~/apps/chimer/chimer
```

## Usage Help

You can see the below usage help by using the command line option `--help`.

$> ~/apps/chimer/chimer --help
Usage: chimer [options] [arguments]

OPTIONS
--sound/$CHIMER_SOUND_DEFAULT <string>
Default path for sound(s) if none are not specified.
--sound-hour/$CHIMER_SOUND_HOUR <string>
Path for sound(s) at zero past an hour.
--sound-quarter-past/$CHIMER_SOUND_QUARTER_PAST <string>
Path for sound(s) at quarter past an hour.
--sound-half-past/$CHIMER_SOUND_HALF_PAST <string>
Path for sound(s) at half past an hour.
--sound-quarter-to/$CHIMER_SOUND_QUARTER_TO <string>
Path for sound(s) at quarter to an hour.
--cache-sounds/$CHIMER_CACHE_SOUNDS <bool> (default: true)
Cache sounds in memory
--repeat-hourly-sound/-r/$CHIMER_REPEAT_HOURLY_SOUND <bool> (default: false)
Repeat the hourly sound T time at T'O clock.
--minimum-volume-level/-l/$CHIMER_MINIMUM_VOLUME_LEVEL <int> (default: 50)
--test-time/$CHIMER_TEST_TIME <value>
Specify a time to test chimer in cron-mode. This option is ignored when cron-mode is not enabled.
--cron/-c/$CHIMER_CRON_MODE_ENABLED <bool> (default: false)
Enable cron-mode where it acts on the current time to decide whether to chime or not
--help/-h
display this help message
--version/-v
display version information

NOTE: All sound paths can be either a relative or full path to an MP3 file or
a directory containing multiple MP3s. In the latter case, one of the files will
be chosen at random for each chime.
2 changes: 1 addition & 1 deletion cmd/chimer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
conf.Version
chimer.Config
TestTime time.Time `conf:"help:Specify a time to test chimer in cron-mode. This option is ignored when cron-mode is not enabled."`
CronModeEnabled bool `conf:"help:Enable cron-mode where it acts on the current time to decide whether to chime or not, and quits."`
CronModeEnabled bool `conf:"flag:cron,short:c,default:false,help:Enable cron-mode where it acts on the current time to decide whether to chime or not, and quits."`
}{
Version: conf.Version{
Build: build,
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type Config struct {
QuarterTo string `conf:"help:Path for sound(s) at quarter to an hour."`
}
CacheSounds bool `conf:"default:true,help:Cache sounds in memory"`
RepeatHourlySound bool `conf:"short:r"`
RepeatHourlySound bool `conf:"short:r,default:false,help:Repeat the hourly sound T time at T'O clock."`
MinimumVolumeLevel int `conf:"default:50,short:l"`
}

Expand Down

0 comments on commit 286b487

Please sign in to comment.