feat(lib): shell: local-dir

This commit is contained in:
2025-07-22 21:15:42 +00:00
parent 8f4ff74546
commit 6e77853453
2 changed files with 15 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ in {
shellModules = {
logs = builtins.readFile ./shell/logs.sh;
check-tool = builtins.readFile ./shell/check-tool.sh;
local-dir = builtins.readFile ./shell/local-dir.sh;
};
sharedShellAliases = {

14
lib/shell/local-dir.sh Normal file
View File

@@ -0,0 +1,14 @@
printf '\033[0;34mDetecting local directories...\033[0m\n'
if git_root=$($BIN_GIT rev-parse --show-toplevel 2>/dev/null); then
LOCAL_DIR="$git_root"
printf '\033[0;32mFound git root: \033[1;37m%s\033[0m\n' "$LOCAL_DIR"
else
LOCAL_DIR="$(pwd)"
printf '\033[1;33mNot in git repo, using current dir: \033[1;37m%s\033[0m\n' "$LOCAL_DIR"
printf 'Are you realy want continue? (y/n):\n'
read -r CONTINUE
if [ "$CONTINUE" != "y" ]; then
printf '\033[0;31mAborting...\033[0m\n'
exit 0
fi
fi