Skip to content

Commit

Permalink
Implement to cd for Nix injected command
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 16, 2024
1 parent fbd8155 commit b9763cf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkgs/posix_shared_functions/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ pkgs.writeText "posix_shared_functions.sh" ''
cd "$(${pkgs.coreutils}/bin/mktemp --directory)"
}
cdn() {
if [ $# -lt 1 ]; then
echo "Specify Nix injected command you want to dive"
return 2
fi
# TODO: Check exit code and Nix or not
local -r command="$(command -v "$1")"
cd "$(dirname "$(dirname "$(readlink "$command")")")"
}
gch() {
fc -nrl 1 | ${lib.getExe fzf-bind-posix-shell-history-to-git-commit-message}
}
Expand Down

0 comments on commit b9763cf

Please sign in to comment.