refactor: add regularity to spaces

1) switch all the miscellaneous indentation to 4 spaces

2) remove the space before the parenthesis of function

3) add indentation inside of if

4) remove miscellaneous spaces at the end of lines
This commit is contained in:
meo 2024-12-12 11:27:21 +01:00
parent 4a6fb83c3d
commit cb89ff94cd
No known key found for this signature in database
GPG Key ID: 8F1ACB6894C1A305

View File

@ -30,14 +30,13 @@ function print_usage() {
}
# print a given text entirely in a given color
function color_echo () {
function color_echo() {
color=$1
text=$2
echo -e "${color}${text}${Color_Off}"
}
function get_rebalance_count () {
function get_rebalance_count() {
file_path=$1
line_nr=$(grep -xF -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1)
@ -53,7 +52,7 @@ function get_rebalance_count () {
}
# rebalance a specific file
function rebalance () {
function rebalance() {
file_path=$1
# check if file has >=2 links in the case of --skip-hardlinks
@ -89,7 +88,7 @@ function rebalance () {
fi
current_index="$((current_index + 1))"
progress_percent=$(printf '%0.2f' "$((current_index*10000/file_count))e-2")
progress_percent=$(printf '%0.2f' "$((current_index * 10000 / file_count))e-2")
color_echo "${Cyan}" "Progress -- Files: ${current_index}/${file_count} (${progress_percent}%)"
if [[ ! -f "${file_path}" ]]; then
@ -195,8 +194,8 @@ function rebalance () {
line_nr=$(grep -xF -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1)
if [ -z "${line_nr}" ]; then
rebalance_count=1
echo "${file_path}" >> "./${rebalance_db_file_name}"
echo "${rebalance_count}" >> "./${rebalance_db_file_name}"
echo "${file_path}" >>"./${rebalance_db_file_name}"
echo "${rebalance_count}" >>"./${rebalance_db_file_name}"
else
rebalance_count_line_nr="$((line_nr + 1))"
rebalance_count="$((rebalance_count + 1))"
@ -214,13 +213,13 @@ if [[ "$#" -eq 0 ]]; then
exit 0
fi
while true ; do
while true; do
case "$1" in
-h | --help )
-h | --help)
print_usage
exit 0
;;
-c | --checksum )
-c | --checksum)
if [[ "$2" == 1 || "$2" =~ (on|true|yes) ]]; then
checksum_flag="true"
else
@ -228,7 +227,7 @@ while true ; do
fi
shift 2
;;
--skip-hardlinks )
--skip-hardlinks)
if [[ "$2" == 1 || "$2" =~ (on|true|yes) ]]; then
skip_hardlinks_flag="true"
else
@ -236,7 +235,7 @@ while true ; do
fi
shift 2
;;
-p | --passes )
-p | --passes)
passes_flag=$2
shift 2
;;
@ -244,7 +243,7 @@ while true ; do
break
;;
esac
done;
done
root_path=$1