Add init for creating config and twtxt file

This commit is contained in:
g1n 2021-07-03 13:10:43 +00:00
parent 9bceb2fffa
commit 15de17688e
1 changed files with 19 additions and 4 deletions

23
twtxt-c
View File

@ -15,13 +15,13 @@ usage() {
-c, --config PATH Specify a custom config file location.
-v, --verbose Enable verbose output for debugging purposes.
--version Show the version and exit.
-h, --help Show this message and exit.
-h, --help Show this message and exit.
Commands:
init Setting up twtxt.
config Get or set config item.
follow Add a new source to your followings.
following Return the list of sources youre following.
quickstart Quickstart wizard for setting up twtxt.
timeline Retrieve your personal timeline.
tweet Append a new tweet to your twtxt file.
unfollow Remove an existing source from your...
@ -33,7 +33,22 @@ case $1 in
usage; exit ;;
-* | --*)
usage; error_exit "unknown option $1" ;;
init)
read -p "Your desired nickname [$USER]: " nickname
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"}
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
twtxt = %s\n
url = %s\n" "$nick" "$twtxt" "$url" >> $config
;;
*)
echo " Work in Progress "
;;
printf "Work in progress\n" ;;
esac