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

Reviewed-on: g1n/twtxt-c#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" ;;
init)
read -p "Your desired nickname [$USER]: " nickname
read -p "Your desired nickname [$USER]: " nick
nick=${nick:-"$USER"}
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
read -p "Type path to your twtxt config folder [/home/$USER/.config/twtxt-c/]: " config
config=${config:-"/home/$USER/.config/twtxt-c/"}
mkdir -p $config
read -p "URL to twtxt [https://example.com/twtxt.txt]: " url
url=${url:-"https://example.com/twtxt.txt"}
printf "[twtxt]\n
nick = %s\n
twtfile = %s\n
url = %s\n" "$nick" "$twtxt" "$url" >> $config
printf "[twtxt]\n nick = %s\n twtfile = %s\n url = %s\n" "$nick" "$path_to_twtxt" "$url" >> $config/config
;;
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)
;;
*)