Merge pull request 'fixed bugs in init and tweet' (#1) from r1k/twtxt-c:main into main

Reviewed-on: #1
This commit is contained in:
g1n 2021-07-04 07:00:05 +00:00
commit 899d476ca5
1 changed files with 4 additions and 7 deletions

11
twtxt-c
View File

@ -34,23 +34,20 @@ case $1 in
-* | --*) -* | --*)
usage; error_exit "unknown option $1" ;; usage; error_exit "unknown option $1" ;;
init) init)
read -p "Your desired nickname [$USER]: " nickname read -p "Your desired nickname [$USER]: " nick
nick=${nick:-"$USER"} nick=${nick:-"$USER"}
read -p "Type path to your twtxt [/home/$USER/twtxt.txt]: " path_to_twtxt read -p "Type path to your twtxt [/home/$USER/twtxt.txt]: " path_to_twtxt
twtxt=${path_to_twtxt:-"/home/$USER/twtxt.txt"} path_to_twtxt=${path_to_twtxt:-"/home/$USER/twtxt.txt"}
echo "" >> $path_to_twtxt echo "" >> $path_to_twtxt
read -p "Type path to your twtxt config folder [/home/$USER/.config/twtxt-c/]: " config read -p "Type path to your twtxt config folder [/home/$USER/.config/twtxt-c/]: " config
config=${config:-"/home/$USER/.config/twtxt-c/"} config=${config:-"/home/$USER/.config/twtxt-c/"}
mkdir -p $config mkdir -p $config
read -p "URL to twtxt [https://example.com/twtxt.txt]: " url read -p "URL to twtxt [https://example.com/twtxt.txt]: " url
url=${url:-"https://example.com/twtxt.txt"} url=${url:-"https://example.com/twtxt.txt"}
printf "[twtxt]\n printf "[twtxt]\n nick = %s\n twtfile = %s\n url = %s\n" "$nick" "$path_to_twtxt" "$url" >> $config/config
nick = %s\n
twtfile = %s\n
url = %s\n" "$nick" "$twtxt" "$url" >> $config
;; ;;
tweet) tweet)
export config=/home/g1n/.config/twtxt/config export config=/home/$USER/.config/twtxt-c/config
printf "%s\t%s\n" "$(date +'%FT%T%:z')" "$2" >> $(awk '/twtfile/ {print $3}' $config) printf "%s\t%s\n" "$(date +'%FT%T%:z')" "$2" >> $(awk '/twtfile/ {print $3}' $config)
;; ;;
*) *)