name : update colors.
This commit is contained in:
parent
6a8c1b0ba0
commit
965539d9b1
|
@ -27,6 +27,10 @@ name()
|
||||||
name="${target%.*}"
|
name="${target%.*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Files w/o extension support.
|
||||||
|
[[ "${ext#.}" = "${name}" ]] && ext=""
|
||||||
|
|
||||||
|
# Get new name.
|
||||||
local new_name=$(parse_simplify "${name}")${ext}
|
local new_name=$(parse_simplify "${name}")${ext}
|
||||||
|
|
||||||
# status line.
|
# status line.
|
||||||
|
@ -34,13 +38,13 @@ name()
|
||||||
|
|
||||||
# check if same name.
|
# check if same name.
|
||||||
if [[ "${target}" = "${new_name}" ]]; then
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
echo -e "${color_green}${status}: no change.${color_default}"
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if target name already exists.
|
# check if target name already exists.
|
||||||
if [[ -f "${new_name}" ]]; then
|
if [[ -f "${new_name}" ]]; then
|
||||||
echo -e "${color_red}${status}: already exists!${color_default}"
|
echo -e "${color_bred}${status}: already exists!${color_default}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ name()
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
|
|
||||||
# show change.
|
# show change.
|
||||||
echo "${status}"
|
echo -e "${color_green}${status}${color_default}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +94,7 @@ name_hash()
|
||||||
|
|
||||||
# check if same name.
|
# check if same name.
|
||||||
if [[ "${target}" = "${new_name}" ]]; then
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
echo -e "${color_green}${status}: no change.${color_default}"
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -98,13 +102,13 @@ name_hash()
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
|
|
||||||
# show change.
|
# show change.
|
||||||
echo -e "${status}"
|
echo -e "${color_green}${status}${color_default}"
|
||||||
else
|
else
|
||||||
# Increment count.
|
# Increment count.
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# Report skip.
|
# Report skip.
|
||||||
echo -e "${color_yellow}[${count}/${total}] ${target}: skipping directory.${color_default}"
|
echo -e "${color_yellow}[${count}/${total}] ${target}: Skipping directory.${color_default}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -140,9 +144,9 @@ name_hash_check()
|
||||||
|
|
||||||
# compare hashes.
|
# compare hashes.
|
||||||
if [[ "${stored}" = "${actual}" ]]; then
|
if [[ "${stored}" = "${actual}" ]]; then
|
||||||
echo -e "${status}: OK."
|
echo -e "${color_green}${status}: Validation OK.${color_default}"
|
||||||
else
|
else
|
||||||
echo -e "${color_red}${status}: failed.${color_default}"
|
echo -e "${color_bred}${status}: Validation failed.${color_default}"
|
||||||
((failed++))
|
((failed++))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -150,7 +154,7 @@ name_hash_check()
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# Report skip.
|
# Report skip.
|
||||||
echo -e "${color_yellow}[${count}/${total}] ${target}: skipping directory.${color_default}"
|
echo -e "${color_yellow}[${count}/${total}] ${target}: Skipping directory.${color_default}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -176,7 +180,7 @@ name_series()
|
||||||
|
|
||||||
# error when no season number specified.
|
# error when no season number specified.
|
||||||
if [[ "${season}" = "" ]]; then
|
if [[ "${season}" = "" ]]; then
|
||||||
echo "usage: name_series <SEASON>"
|
echo "usage: name_series <SEASON> [FILES]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -200,15 +204,23 @@ name_series()
|
||||||
# prepare status.
|
# prepare status.
|
||||||
local status="[${count}/${total}] ${target} -> ${new_name}"
|
local status="[${count}/${total}] ${target} -> ${new_name}"
|
||||||
|
|
||||||
|
# Warning on no change.
|
||||||
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# rename target.
|
# rename target.
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
echo -e "${status}"
|
|
||||||
|
# Report status.
|
||||||
|
echo -e "${color_green}${status}${color_default}"
|
||||||
else
|
else
|
||||||
# Increment count.
|
# Increment count.
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# Report skip.
|
# Report skip.
|
||||||
echo -e "${color_yellow}[${count}/${total}] ${target}: skipping directory.${color_default}"
|
echo -e "${color_yellow}[${count}/${total}] ${target}: Skipping directory.${color_default}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -226,7 +238,7 @@ name_manga()
|
||||||
|
|
||||||
# error when no season number specified.
|
# error when no season number specified.
|
||||||
if [[ "${season}" = "" ]]; then
|
if [[ "${season}" = "" ]]; then
|
||||||
echo "usage: name_manga <SEASON>"
|
echo "usage: name_manga <SEASON> [FILES]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -250,15 +262,23 @@ name_manga()
|
||||||
# prepare status.
|
# prepare status.
|
||||||
local status="[${count}/${total}] ${target} -> ${new_name}"
|
local status="[${count}/${total}] ${target} -> ${new_name}"
|
||||||
|
|
||||||
|
# Warning on no change.
|
||||||
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# rename target.
|
# rename target.
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
echo -e "${status}"
|
|
||||||
|
# Show status.
|
||||||
|
echo -e "${color_green}${status}${color_default}"
|
||||||
else
|
else
|
||||||
# Increment count.
|
# Increment count.
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# Report skip.
|
# Report skip.
|
||||||
echo -e "${color_yellow}[${count}/${total}] ${target}: skipping directory.${color_default}"
|
echo -e "${color_yellow}[${count}/${total}] ${target}: Skipping directory.${color_default}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -297,17 +317,23 @@ name_ext()
|
||||||
# Prepare status.
|
# Prepare status.
|
||||||
local status="[${count}/${total}] ${target} -> ${new_name}"
|
local status="[${count}/${total}] ${target} -> ${new_name}"
|
||||||
|
|
||||||
|
# Warning on no change.
|
||||||
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# rename target.
|
# rename target.
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
|
|
||||||
# show change.
|
# show change.
|
||||||
echo "${status}"
|
echo -e "${color_green}${status}${color_default}"
|
||||||
else
|
else
|
||||||
# Increment count.
|
# Increment count.
|
||||||
((count++))
|
((count++))
|
||||||
|
|
||||||
# Report skip.
|
# Report skip.
|
||||||
echo -e "${color_yellow}[${count}/${total}] ${target}: skipping directory.${color_default}"
|
echo -e "${color_yellow}[${count}/${total}] ${target}: Skipping directory.${color_default}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -339,11 +365,17 @@ name_prefix()
|
||||||
# Prepare status.
|
# Prepare status.
|
||||||
local status="[${count}/${total}] ${target} -> ${new_name}"
|
local status="[${count}/${total}] ${target} -> ${new_name}"
|
||||||
|
|
||||||
|
# Warning on no change.
|
||||||
|
if [[ "${target}" = "${new_name}" ]]; then
|
||||||
|
echo -e "${color_yellow}${status}: No change.${color_default}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Rename.
|
# Rename.
|
||||||
mv -- "${target}" "${new_name}" &> /dev/null
|
mv -- "${target}" "${new_name}" &> /dev/null
|
||||||
|
|
||||||
# Show change.
|
# Show change.
|
||||||
echo "${status}"
|
echo -e "${color_green}${status}${color_default}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue