mirror of
https://github.com/sadan4/dotfiles.git
synced 2025-06-22 04:07:00 -04:00
add detach command
This commit is contained in:
parent
2cc417088a
commit
14704808f6
2 changed files with 28 additions and 0 deletions
|
@ -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 = {
|
||||
|
|
20
common/users/homeModules/scripts/detach.sh
Normal file
20
common/users/homeModules/scripts/detach.sh
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue