Go based extra tools for shell scripting.
Either download the release and unpack it some place. Or:
curl -Ls https://raw.githubusercontent.com/jvzantvoort/tmux-project/main/tmux-project-update | bash
Updating can be done with:
tmux-project-update
Print a colored status.
Usages:
cprint [red|oke|magenta|green|nok|workspace|blue|cyan|white|yellow|debug|black|profile|platform|warn|ok] message
WIP
Move a file with avoiding duplicates or overwriting different files:
Example:
Generate a random file:
# tr -dc A-Za-z0-9 </dev/urandom | head -c 13 > tempfile
Copy the file to a backup:
# cp tempfile tempfile.dup
Move the original to a bck/
folder:
# mvx tempfile bck/
target found /home/jvzantvoort/tmp/tempfile [ SUCCESS ]
target found /home/jvzantvoort/tmp/bck/tempfile [ FAILURE ]
move tempfile [ SUCCESS ]
Note: the error points to no dups found.
Copy the duplicate to the original and repeat, effectively moving the same file twice:
# mv tempfile.dup tempfile
# mvx tempfile bck/
target found /home/jvzantvoort/tmp/tempfile [ SUCCESS ]
target found /home/jvzantvoort/tmp/bck/tempfile [ SUCCESS ]
move tempfile [ SUCCESS ]
Create a new tempfile and move it:
# tr -dc A-Za-z0-9 </dev/urandom | head -c 13 > tempfile
# mvx tempfile bck/
target found /home/jvzantvoort/tmp/tempfile [ SUCCESS ]
target found /home/jvzantvoort/tmp/bck/tempfile [ SUCCESS ]
target found /home/jvzantvoort/tmp/bck/tempfile.1 [ FAILURE ]
move tempfile [ SUCCESS ]
The result is the original moved and the second version moved to a .1
file:
# ls -l bck
total 8
-rw-r--r--. 1 jvzantvoort jvzantvoort 13 Aug 10 21:03 tempfile
-rw-r--r--. 1 jvzantvoort jvzantvoort 13 Aug 10 21:04 tempfile.1
Returns a cleaned up version of the path
Alias for cprint
Returns "vYYWW." as a timestamp