diff --git a/scripts/_Team_Defines.bash b/scripts/_Team_Defines.bash index f07dc05f..3eeffc94 100644 --- a/scripts/_Team_Defines.bash +++ b/scripts/_Team_Defines.bash @@ -81,6 +81,31 @@ alias ros2_control_setup-controller-package=$RosTeamWS_FRAMEWORK_SCRIPTS_PATH/ro # setup auto-sourcing alias setup-auto-sourcing=$RosTeamWS_FRAMEWORK_SCRIPTS_PATH/setup_auto_sourcing.bash +# VCS Aliases and helpers +function rtw-ws-import () { + # TODO: if not argument use WS default path for this after #169 is merged + vcs import --debug -w 1 --input "$*" $ROS_WS/src +} + +# Temporary files cleaning +function rtw-find-and-remove-core-files () { + if [ -z "$1" ]; then + search_dir="${HOME}" + else + search_dir=$1 + fi + + find "${search_dir}" -type f -regex ".*core\.[0-9]+" + + user_decision "Do you want to delete those files?" user_answer + if [[ " ${positive_answers[*]} " =~ " ${user_answer} " ]]; then + find "${search_dir}" -type f -regex ".*core\.[0-9]+" -delete + notify_user "Files ARE deleted!" + else + notify_user "Files NOT deleted!" + fi +} + # Team General aliases and functions function generate_gif_from_video { diff --git a/scripts/setup_auto_sourcing.bash b/scripts/setup_auto_sourcing.bash index c48d2f79..435a4c37 100755 --- a/scripts/setup_auto_sourcing.bash +++ b/scripts/setup_auto_sourcing.bash @@ -29,11 +29,8 @@ echo "Copying ${rtw_file} to your home folder." if ! [ -f "$HOME/$rtw_file" ]; then cp "${template_location}" ~/. else - new_rtw_file_name="${rtw_file}.bkp-$(ls ${rtw_file_location}* | wc -l)" echo "" - notify_user "${rtw_file} already exists. Moved it to ${new_rtw_file_name}." - mv "${rtw_file_location}" "$HOME/${new_rtw_file_name}" || { echo "Error: Could not create a copy of already existing ${rtw_file}. Please rename this file and run script again."; return 1; } - cp "${template_location}" ~/. + notify_user "${rtw_file} already exists." fi sed -i "s|source /setup.bash|source $FRAMEWORK_BASE_PATH/setup.bash|g" "$rtw_file_location"