dotfiles/config/nix/scripts/rep
Geoffrey Frogeye 1f61ceb395
nix: Migrate scripts
They're a bit slower to start :(.
Hopefully this is something that flakes will help with,
otherwise I'll find another way.
2023-11-26 21:04:58 +01:00

28 lines
474 B
Plaintext
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p bash coreutils
# Moves a file to another place and put a symbolic link in place
function rep_help {
echo "Usage: $0 SOURCE DEST"
echo
echo "Arguments:"
echo " SOURCE File to be moved"
echo " DEST Where to be moved"
return 0
}
mv "$1" "$2"
ln -s "$2" "$1"
# MAIN
command="$1"
shift
if type "rep_$command" &> /dev/null; then
"rep_$command" "$@"
else
rep_help
fi