From: Oleg Broytman Date: Fri, 15 Jun 2018 16:34:56 +0000 (+0300) Subject: Feat: Add script for moving projects X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=ec7ddd82b978788b2e620e7b44beec5a2a4c72ac;p=cookiecutter.git Feat: Add script for moving projects --- diff --git a/move-project b/move-project new file mode 100755 index 0000000..72f7475 --- /dev/null +++ b/move-project @@ -0,0 +1,27 @@ +#! /bin/sh + +if [ -z "$1" -o -n "$2" ]; then + echo "Usage: $0 project_name" >&2 + exit 1 +fi + +project_name="$1" +old_dir="$HOME/admin/prog/$1" +new_dir="$HOME/prog/Python/$1" + +fix_path() { + config_option="$1" + path="`git config --get $config_option`" + new_path="`echo \"$path\" | sed \"s@$old_dir@$new_dir@\"`" + git config "$config_option" "$new_path" +} + +mv "$old_dir" "$new_dir" && + +for project_dir in "$new_dir" "$HOME"/current/projects/"$project_name" \ + "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$project_name".git; do + cd "$project_dir" && + for remote in `git remote`; do + fix_path "remote.$remote.url" + done +done