add detach command

This commit is contained in:
sadan 2025-06-11 14:27:34 -04:00
parent 2cc417088a
commit 14704808f6
No known key found for this signature in database
2 changed files with 28 additions and 0 deletions

View file

@ -19,6 +19,7 @@ let
executable = true;
destination = "/bin/${name}";
text = ''
export PATH=""
for i in ${lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
@ -78,6 +79,13 @@ in
direnv
];
})
(mkScript {
name = "detach";
file = ./detach.sh;
env = with pkgs; [
coreutils
];
})
# impl for the cloneRepo command
];
file = {

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eo pipefail
function echoe() {
echo $@ 1>&2
}
function printUsage() {
echoe "Usage: ${0} FILE"
echoe "Unlink a file by copying the original file to the link path"
echoe "Shorthand for cp -P \$(readlink \$FILE) $FILE"
}
if [[ -z $1 ]]; then
echoe "${0}: missing file"
printUsage
exit 1
fi
cp -P $(readlink $1) $1