mirror of
https://github.com/arkenfox/user.js.git
synced 2025-04-21 16:16:50 -04:00
updater.sh: -l auto select if only one profile
This commit is contained in:
parent
3b70fab06d
commit
bbbb6f05d2
35
updater.sh
35
updater.sh
@ -58,12 +58,19 @@ set_wd () {
|
||||
echo -e ${RED}"Error: Sorry, -l is not supported for your OS"${NC}
|
||||
exit 1
|
||||
fi
|
||||
echo -e ${GREEN}"The following profiles were found:\n"${ORANGE}
|
||||
ls -d "$firefox_dir"*
|
||||
echo -e ${RED}"\nWhich profile would you like to update?"${NC}
|
||||
read -p ""
|
||||
echo -e ""
|
||||
ff_profile=$REPLY
|
||||
numdirs=("$firefox_dir"/*)
|
||||
numdirs=${#numdirs[@]}
|
||||
if [[ $numdirs == "1" ]]; then
|
||||
ff_profile=$(ls -d "$firefox_dir"*)
|
||||
else
|
||||
echo "wrong"
|
||||
echo -e ${GREEN}"The following profiles were found:\n"${ORANGE}
|
||||
ls -d "$firefox_dir"*
|
||||
echo -e ${RED}"\nWhich profile would you like to update?"${NC}
|
||||
read -p ""
|
||||
echo -e ""
|
||||
ff_profile=$REPLY
|
||||
fi
|
||||
else
|
||||
ff_profile="$PROFILE_PATH"
|
||||
fi
|
||||
@ -295,14 +302,14 @@ update_userjs () {
|
||||
remove_comments $pastuserjs $past_nocomments
|
||||
remove_comments user.js $current_nocomments
|
||||
|
||||
diffname="userjs_diffs/diff_$(date +"%Y-%m-%d_%H%M").txt"
|
||||
diff=$(diff -w -B -U 0 $past_nocomments $current_nocomments)
|
||||
if [ ! -z "$diff" ]; then
|
||||
echo "$diff" > "$diffname"
|
||||
echo -e "Status: ${GREEN}A diff file was created:${NC} ${PWD}/${diffname}"
|
||||
else
|
||||
echo -e "Warning: ${ORANGE}Your new user.js file appears to be identical. No diff file was created."${NC}
|
||||
fi
|
||||
diffname="userjs_diffs/diff_$(date +"%Y-%m-%d_%H%M").txt"
|
||||
diff=$(diff -w -B -U 0 $past_nocomments $current_nocomments)
|
||||
if [ ! -z "$diff" ]; then
|
||||
echo "$diff" > "$diffname"
|
||||
echo -e "Status: ${GREEN}A diff file was created:${NC} ${PWD}/${diffname}"
|
||||
else
|
||||
echo -e "Warning: ${ORANGE}Your new user.js file appears to be identical. No diff file was created."${NC}
|
||||
fi
|
||||
|
||||
rm $past_nocomments $current_nocomments $pastuserjs
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user