diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-12-23 16:23:22 +0200 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-12-23 16:23:22 +0200 |
commit | 2e0927fc93f57931f31b38f3a4065c07841fab53 (patch) | |
tree | 20ecd8020a9a1eba3522a8907a59cd24a9ece801 | |
parent | 51f3ed41cc49dea1143e638825c26274eb836b7b (diff) | |
download | nixos-configuration-2e0927fc93f57931f31b38f3a4065c07841fab53.tar.gz nixos-configuration-2e0927fc93f57931f31b38f3a4065c07841fab53.tar.bz2 nixos-configuration-2e0927fc93f57931f31b38f3a4065c07841fab53.zip |
feat: update git-clean syntax
-rw-r--r-- | home-manager/stvnliu/scripts/git_check_clean.script.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/home-manager/stvnliu/scripts/git_check_clean.script.nix b/home-manager/stvnliu/scripts/git_check_clean.script.nix index 6ee2747..439913d 100644 --- a/home-manager/stvnliu/scripts/git_check_clean.script.nix +++ b/home-manager/stvnliu/scripts/git_check_clean.script.nix @@ -5,8 +5,8 @@ git = config.programs.git.package; in pkgs.writeShellScriptBin "git-check-clean" '' - #!${pkgs.bash}/bin/bash - cd_err() { + #!${pkgs.bash}/bin/bash + cd_err() { echo "change-directory occurred error. interrupting..." } git_check() { @@ -17,8 +17,10 @@ in echo "Could not parse filter string" return fi + #echo "Checking git-cleanliness at $repo_dir, working in $PWD" cd "$repo_dir" || return inside_git_repo="$(${git}/bin/git rev-parse --is-inside-work-tree 2>/dev/null)" + result=256 if [ "$inside_git_repo" ]; then if [ "$(${git}/bin/git status --porcelain)" ]; then result=0 @@ -30,6 +32,10 @@ in if [ "$filter" = "dirty" ]; then if [[ $result -eq 0 ]]; then echo "DIRTY $PWD" + read -rp "Enter dirty directory? [y/N] " userinput + if [[ "$userinput" = "y" ]]; then + $SHELL + fi fi else if [[ $result -eq 1 ]]; then @@ -39,10 +45,8 @@ in #echo "going back to $prev" cd "$prev" || return } - export -f git_check - export -f cd_err path=$PWD - for item in $(${pkgs.findutils}/bin/find . -maxdepth 1 -type d); do + for item in $(find . -maxdepth 1 -type d); do git_check "$path" "$item" "$1" done '' |