#!/usr/bin/env zsh [ "${ZSH_VERSION:-}" = "" ] && echo >&2 "Only works with zsh" && exit 1 setopt err_exit no_unset pipefail extended_glob # Simple script to update the godoc comments on all watchers. Probably took me # more time to write this than doing it manually, but ah well 🙃 watcher=$(</tmp/x print -r -- $cmt >>/tmp/x tail -n+$(( end + 1 )) $file >>/tmp/x mv /tmp/x $file done } set-cmt '^type Watcher struct ' $watcher set-cmt '^func NewWatcher(' $new set-cmt '^func (w \*Watcher) Add(' $add set-cmt '^func (w \*Watcher) Remove(' $remove set-cmt '^func (w \*Watcher) Close(' $close set-cmt '^func (w \*Watcher) WatchList(' $watchlist set-cmt '^[[:space:]]*Events *chan Event$' $events set-cmt '^[[:space:]]*Errors *chan error$' $errors