add --update option to dependency_age.sh
exit_code=0
color_red=$(echo -ne "\033[1;31m")
color_green=$(echo -ne "\033[1;32m")
+color_blue=$(echo -ne "\033[1;34m")
color_reset=$(echo -ne "\033[0m")
for package in packages/* ; do
@@ -18,8 +19,13 @@ for package in packages/* ; do
newest_version=$(echo -e "${last_version}\n${actual_version}" | sort -V | tail -1)
if [ "${newest_version}" == "${actual_version}" ] ; then
echo "${color_green}newest${color_reset}"
+ else
+ if [ "$1" = "--update" ] ; then
+ sed -i "s/${dependency} = \"${actual_version}\"/${dependency} = \"${last_version}\"/g" "${package}/Cargo.toml"
+ echo "${color_blue}old, updated to ${last_version}${color_reset}"
else
echo "${color_red}old, please update to latest ${last_version}${color_reset}"
+ fi
((exit_code++))
fi
