Skip to content

Commit

Permalink
[scripts] ,remote-workspace: better ignore filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
meain committed May 4, 2024
1 parent cb93864 commit 030aa4f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions scripts/.local/bin/random/,remote-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,38 @@ generate_ignore_string() {
}

get_ignore_string() {
# git status --ignored|grep -E '^\s'|grep -v '^ ('|sed 's|\s||'>.rworkspaceignore
# git status --ignored | grep -E '^\s' |
# grep -v '^ (' | sed 's|\s||' |
# grep -v shell.nix |
# grep -v .mscripts >.rworkspaceignore

if [ -f .rworkspaceignore ]; then
IGNORE_STRING="$(generate_ignore_string .rworkspaceignore)"
generate_ignore_string .rworkspaceignore
elif [ -f .gitignore ]; then
IGNORE_STRING="$(generate_ignore_string .gitignore)"
# generate_ignore_string .gitignore
git status --ignored | grep -E '^\s' |
grep -v '^ (' | sed 's|\s||' |
grep -v shell.nix |
grep -v .mscripts
elif [ -f .dockerignore ]; then
IGNORE_STRING="$(generate_ignore_string .dockerignore)"
generate_ignore_string .dockerignore
fi
}

case "$OP" in
shell) echo "Data not synced" && ssh "$EXPERIMENT_VM" -t "cd workspace/$TNAME && bash" ;; # start simple shell
nix) echo "Data not synced" && ssh "$EXPERIMENT_VM" -t "cd workspace/$TNAME && bash -ic nix-shell" ;; # start with nix shell

sync) rsync -azvr --exclude '.git' $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" ;; # sync
rsync) rsync -azvr --exclude '.git' $(get_ignore_string) "$EXPERIMENT_VM:workspace/$TNAME/" . ;; # reverse sync
dsync) rsync -azvr --exclude '.git' $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" --delete ;; # sync with delete
csync) find . | entr rsync -azvr --exclude '.git' $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" ;; # continuous sync

gsync) rsync -azvr $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" ;; # with-git sync
grsync) rsync -azvr $(get_ignore_string) "$EXPERIMENT_VM:workspace/$TNAME/" . ;; # with-git reverse sync
gdsync) rsync -azvr $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" --delete ;; # with-git sync with delete
gcsync) find . | entr rsync -azvr $(get_ignore_string) . "$EXPERIMENT_VM:workspace/$TNAME" ;; # with-git continuous sync

run) echo "Data not synced" && ssh "$EXPERIMENT_VM" -t "cd workspace/$TNAME && bash -ic '$1'" ;; # run a command
web) open "http://$VM_IP" ;; # open likely webpage
copy) scp -r "$EXPERIMENT_VM:workspace/$TNAME/$1" "${2:-$1}" ;; # copy contents
Expand Down

0 comments on commit 030aa4f

Please sign in to comment.