diff options
author | Case Duckworth | 2023-03-05 23:25:01 -0600 |
---|---|---|
committer | Case Duckworth | 2023-03-05 23:25:01 -0600 |
commit | 1f94aae0d69b4947bc2daef593813608b9d1b5ff (patch) | |
tree | 1b940227f2aea3327fc863287c282601e425264a | |
parent | Display @'s better (diff) | |
download | twerk-1f94aae0d69b4947bc2daef593813608b9d1b5ff.tar.gz twerk-1f94aae0d69b4947bc2daef593813608b9d1b5ff.zip |
Add user option
-rwxr-xr-x | twerk | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/twerk b/twerk index 02bd631..8fe163e 100755 --- a/twerk +++ b/twerk | |||
@@ -25,6 +25,7 @@ options (default): | |||
25 | -p COMMAND Use COMMAND to post twts ([not set]). | 25 | -p COMMAND Use COMMAND to post twts ([not set]). |
26 | This command will be fed a twtxt-formatted string via stdin. | 26 | This command will be fed a twtxt-formatted string via stdin. |
27 | Recommended: \`ssh <host> tee -a <file>\`. | 27 | Recommended: \`ssh <host> tee -a <file>\`. |
28 | -u USER The username to use when twting ([current user name]). | ||
28 | 29 | ||
29 | parameters: | 30 | parameters: |
30 | FILE List of twtxt feeds to fetch, one feed per line. | 31 | FILE List of twtxt feeds to fetch, one feed per line. |
@@ -43,8 +44,9 @@ configure() { | |||
43 | TWERK_HANG="${TWERK_HANG:-}" # empty to calculate off other variables | 44 | TWERK_HANG="${TWERK_HANG:-}" # empty to calculate off other variables |
44 | TWERK_FORCE="${TWERK_FORCE:-false}" | 45 | TWERK_FORCE="${TWERK_FORCE:-false}" |
45 | TWERK_POST_COMMAND="${TWERK_POST_COMMAND:-:}" # no-op | 46 | TWERK_POST_COMMAND="${TWERK_POST_COMMAND:-:}" # no-op |
47 | TWERK_USER="$(whoami)" | ||
46 | 48 | ||
47 | while getopts htfn:w:W:i:p:c: opt | 49 | while getopts htfn:w:W:i:p:c:u: opt |
48 | do | 50 | do |
49 | case "$opt" in | 51 | case "$opt" in |
50 | h) usage ;; | 52 | h) usage ;; |
@@ -56,6 +58,7 @@ configure() { | |||
56 | i) TWERK_HANG="$OPTARG" ;; | 58 | i) TWERK_HANG="$OPTARG" ;; |
57 | p) TWERK_POST_COMMAND="$OPTARG" ;; | 59 | p) TWERK_POST_COMMAND="$OPTARG" ;; |
58 | c) TWERK_FEEDS="$OPTARG" ;; | 60 | c) TWERK_FEEDS="$OPTARG" ;; |
61 | u) TWERK_USER="$OPTARG" ;; | ||
59 | *) usage 1 ;; | 62 | *) usage 1 ;; |
60 | esac | 63 | esac |
61 | done | 64 | done |
@@ -245,6 +248,7 @@ post() { | |||
245 | 248 | ||
246 | eval "printf '%s\n' \"\$post\" | $TWERK_POST_COMMAND" | 249 | eval "printf '%s\n' \"\$post\" | $TWERK_POST_COMMAND" |
247 | _TWERK_INITIAL=false main "$TWERK_FEEDS" | 250 | _TWERK_INITIAL=false main "$TWERK_FEEDS" |
251 | rm "$TWERK_CACHE/$TWERK_USER" | ||
248 | } | 252 | } |
249 | 253 | ||
250 | refresh() { | 254 | refresh() { |