after

command module
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 16 Imported by: 0

README

after

A predictable terminal timer for durations and times of day, with clean output and reliable scripting behavior.

Latest Release License Go

after demo
after 10m   # simple countdown
after 1pm   # until next 1 PM

Why after?

after is a small, predictable terminal timer that behaves well both interactively and in scripts.

  • Shows a live countdown when you're in a terminal
  • Accepts both fixed durations and times of day (after 1pm)
  • Keeps stdout clean and sends lifecycle events to stderr
  • Stays quiet and well-behaved when output is redirected or piped
  • Plays an optional alert when the timer completes

It’s designed to feel natural at the command line, without surprises.

Quick Start

Install and run in under a minute (requires Homebrew):

brew install mtn-man/tools/after
after 10m

Once running, use q, esc, ctrl+c or ctrl+d to cancel.

If after is not found once installed, see Troubleshooting.

Installation

Note: Windows is not currently supported. If you want it, let us know!

Install With Go

Requires Go 1.23+ on macOS, Linux, or BSD. Get Go: https://go.dev/dl/

Install the latest version:

go install github.com/mtn-man/after@latest

Or install a specific release:

go install github.com/mtn-man/after@<version>

Or clone and build locally:

git clone https://github.com/mtn-man/after.git
cd after
go build -o after .
./after --version
Install Prebuilt Release Binary

Prefer a manual install? Download a prebuilt binary:

Binary installation steps (macOS and Linux)
  1. Download your platform archive and checksums.txt from the latest release. Replace <version> in the examples below with the release tag (for example, vX.Y.Z). Archive naming pattern:

    • after_<version>_darwin_amd64.tar.gz
    • after_<version>_darwin_arm64.tar.gz
    • after_<version>_linux_amd64.tar.gz
    • after_<version>_linux_arm64.tar.gz

    Note: release filenames use darwin to refer to macOS. The examples below use macOS Apple Silicon filenames; swap in the archive and binary names for your OS/architecture.

  2. Verify checksum (optional but recommended): Example for macOS Apple Silicon:

    grep "after_<version>_darwin_arm64.tar.gz$" checksums.txt | shasum -a 256 -c -
    

    Example for Linux:

    grep "after_<version>_linux_amd64.tar.gz$" checksums.txt | sha256sum -c -
    
  3. Extract your archive (example shown for macOS Apple Silicon):

    tar -xzf after_<version>_darwin_arm64.tar.gz
    
  4. Install the extracted binary into /usr/local/bin (default):

    sudo install -m 0755 after_darwin_arm64 /usr/local/bin/after
    

    If you are on a different platform, replace the archive and binary filenames above with the matching release files for your OS/architecture.

  5. Alternative (no sudo): install to ~/.local/bin:

    mkdir -p ~/.local/bin
    install -m 0755 after_darwin_arm64 ~/.local/bin/after
    

    If ~/.local/bin is not in your PATH, add it to your shell startup file (for example, ~/.zshrc or ~/.bashrc), then reload your shell:

    # zsh
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    
    # bash
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
    
  6. Verify:

    after --version
    

Usage

after [options] <duration|time>

Durations are relative. Times refer to the next occurrence — wrapping to tomorrow if already passed.

Examples
# durations
after 30        # bare number = seconds
after 5m        # minutes
after 1h30m     # hours and minutes
after 1.5h      # decimal hours

# times of day
after 9am       # next 9:00 AM
after 9p        # next 9:00 PM
after 14:30     # 24-hour format
after 2:30 PM   # 12-hour with AM/PM
after noon      # 12:00 PM
after midnight  # 12:00 AM

# flags
after -q 5m                    # suppress alarm and status output
after -qs 5m                   # quiet but keep alarm
after -qt 5m                   # quiet and no title bar updates
after -f ~/sounds/bell.mp3 5m  # custom alert sound

# scripting
after 10m 2> /tmp/after.log   # capture lifecycle output
after -s 10m 2> /dev/null &   # background with alarm

Options may be placed before or after the time value. Short flags can be combined: -qt, -qs, -qts. Run after --help for all flags.

Behavior

Status output goes to stderr, leaving stdout clean for pipelines. The countdown shows only significant fields (1:23 for 83 seconds, 1:02:03 for just over an hour).

When output is redirected (e.g. 2> /tmp/after.log), the countdown is suppressed and only lifecycle lines are emitted: after: started (...), after: complete, and after: cancelled. The alarm does not play in this mode unless --sound is specified.

On macOS, after prevents the system from sleeping for its duration. Use --caffeinate to force this when output is redirected.

Troubleshooting

  • after not found after install (after: command not found): Ensure your install location is in PATH (/opt/homebrew/bin or /usr/local/bin for Homebrew, $(go env GOPATH)/bin or GOBIN for go install, /usr/local/bin or ~/.local/bin for manual install), then restart or reload your shell.
  • Permission denied while installing to /usr/local/bin: Use sudo install ... or install to ~/.local/bin instead.
  • Homebrew command ambiguity with an existing after formula: use brew install mtn-man/tools/after and brew info mtn-man/tools/after.

Contributing

Bug reports, suggestions, and pull requests are welcome. Open an issue to start a conversation.

License

MIT License. See LICENSE file for details.

Disclaimer

This tool has been made using LLM assistance for code review and bugfixes; All code is human reviewed and verified to work as intended.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL