dot

packages and services management
Log | Files | Refs | README

commit 2c1b0cdb784a313b983a24cec2c4c5cd75279b2f
parent a720c7cf516bde281f9bdaee92626e4991080825
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 13 Mar 2018 10:30:57 +0100

twt: fix time

Diffstat:
Dbin/.twt.swp | 0
Mbin/twt | 12++----------
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/bin/.twt.swp b/bin/.twt.swp Binary files differ. diff --git a/bin/twt b/bin/twt @@ -81,8 +81,7 @@ function rfc3339(str) { hrs = substr(str, 12, 2); min = substr(str, 15, 2); sec = substr(str, 18, 2); - sub("^[^ ]+\\.[0-9]+", "", str); - off = substr(str, 1, 1) == "Z" ? 0 : substr(str, 1, 3); + off = substr(str, 20, 1) == "Z" ? 0 : substr(str, 20, 3); return to_sec(yrs, mth, day, hrs, min, sec) - off * 3600; } @@ -96,7 +95,7 @@ BEGIN { sub("[^\t]*\t", "", $0); gsub("\t", " ", $0); sub(".*/", "", FILENAME); - lines[++nb] = sprintf("%s\t%s\t%s", sec, FILENAME, $0); + lines[++nb] = sprintf("%010d\t%s\t%s", sec, FILENAME, $0); } END { @@ -127,7 +126,6 @@ touch "$TWT_CONF" case "$1" in (tweet) [ "$#" -ne 2 ] && exec "$0" - msg=$(printf %s "$2" | sed 's|[^ ]*://[^ ]*|@<&>|' | tr '\n' ' ') while read -r usr url do @@ -142,13 +140,11 @@ case "$1" in (view) [ "$#" -ne 2 ] && exec "$0" [ -f "$TWT_PATH/$2" ] || err "$2 feed not found, try update" - awk "$show" "$TWT_PATH/$2" ;; (timeline) [ "$#" -ne 1 ] && exec "$0" ls "$TWT_PATH"/* 2> /dev/null 1>&2 || err 'no feed found, twt update' - awk "$show" "$TWT_PATH"/* ;; (update) @@ -160,10 +156,8 @@ case "$1" in ;; (follow) [ "$#" -ne 3 ] && exec "$0" - sed 's/[[:space:]].*//' "$TWT_CONF" | grep -Fqx "$2" && err "already following $2" - printf '%s\t%s\n' "$2" "$3" >> "$TWT_CONF" sort -uo "$TWT_CONF" "$TWT_CONF" ;; @@ -171,13 +165,11 @@ case "$1" in [ "$#" -ne 2 ] && exec "$0" sed 's/[[:space:]].*//' "$TWT_CONF" | grep -Fqx "$2" || err "not following $2" - sed "/^$(printf %s "$2" | sed 's/./[&]/g')[[:space:]]/ d" "$TWT_CONF" | sort -uo "$TWT_CONF" ;; (following) [ "$#" -ne 1 ] && exec "$0" - sed -r 's/[[:space:]]/ /; s/(.{11}[^ ]*) */\1 @ /' "$TWT_CONF" ;; (*)