From 1f94aae0d69b4947bc2daef593813608b9d1b5ff Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 5 Mar 2023 23:25:01 -0600 Subject: Add user option --- twerk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/twerk b/twerk index 02bd631..8fe163e 100755 --- a/twerk +++ b/twerk @@ -25,6 +25,7 @@ options (default): -p COMMAND Use COMMAND to post twts ([not set]). This command will be fed a twtxt-formatted string via stdin. Recommended: \`ssh tee -a \`. + -u USER The username to use when twting ([current user name]). parameters: FILE List of twtxt feeds to fetch, one feed per line. @@ -43,8 +44,9 @@ configure() { TWERK_HANG="${TWERK_HANG:-}" # empty to calculate off other variables TWERK_FORCE="${TWERK_FORCE:-false}" TWERK_POST_COMMAND="${TWERK_POST_COMMAND:-:}" # no-op + TWERK_USER="$(whoami)" - while getopts htfn:w:W:i:p:c: opt + while getopts htfn:w:W:i:p:c:u: opt do case "$opt" in h) usage ;; @@ -56,6 +58,7 @@ configure() { i) TWERK_HANG="$OPTARG" ;; p) TWERK_POST_COMMAND="$OPTARG" ;; c) TWERK_FEEDS="$OPTARG" ;; + u) TWERK_USER="$OPTARG" ;; *) usage 1 ;; esac done @@ -245,6 +248,7 @@ post() { eval "printf '%s\n' \"\$post\" | $TWERK_POST_COMMAND" _TWERK_INITIAL=false main "$TWERK_FEEDS" + rm "$TWERK_CACHE/$TWERK_USER" } refresh() { -- cgit 1.4.1-21-gabe81