mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2025-05-24 19:14:39 +02:00
shell/{gitrepo,nixos}-commited: hide in nix-shell
This commit is contained in:
parent
40fa23a90e
commit
ab1d79433a
2 changed files with 21 additions and 18 deletions
|
@ -4,16 +4,18 @@ case "$-" in
|
||||||
*i*)
|
*i*)
|
||||||
# This shell is interactive, if not ignore this part
|
# This shell is interactive, if not ignore this part
|
||||||
# If printing this in non-interactive shells, it'll may prevent scp to work
|
# If printing this in non-interactive shells, it'll may prevent scp to work
|
||||||
cfgrepo=`readlink ~/.profile.d/10-gitrepo-commited.sh`
|
if [ -z "${IN_NIX_SHELL}" ]; then
|
||||||
repo=`dirname $cfgrepo`
|
cfgrepo=$(readlink ~/.profile.d/10-gitrepo-commited.sh)
|
||||||
changes=`git -C $repo status --porcelain | wc -l`
|
repo=$(dirname "$cfgrepo")
|
||||||
|
changes=$(git -C "$repo" status --porcelain | wc -l)
|
||||||
|
|
||||||
if [ $changes -gt 0 ]; then
|
if [ "$changes" -gt 0 ]; then
|
||||||
echo -e '\e[01;31m' >&2
|
printf '\e[01;31m\n' >&2
|
||||||
echo -e '####################################' >&2
|
printf '####################################\n' >&2
|
||||||
echo -e '# GIT-config-Repo is not commited! #' >&2
|
printf '# GIT-config-Repo is not commited! #\n' >&2
|
||||||
echo -e '####################################' >&2
|
printf '####################################\n' >&2
|
||||||
echo -e '\e[0m' >&2
|
printf '\e[0m\n' >&2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -4,15 +4,16 @@ case "$-" in
|
||||||
*i*)
|
*i*)
|
||||||
# This shell is interactive, if not ignore this part
|
# This shell is interactive, if not ignore this part
|
||||||
# If printing this in non-interactive shells, it'll may prevent scp to work
|
# If printing this in non-interactive shells, it'll may prevent scp to work
|
||||||
|
if [ -z "${IN_NIX_SHELL}" ]; then
|
||||||
if [ -d "/etc/nixos" ]; then
|
if [ -d "/etc/nixos" ]; then
|
||||||
changes=`git -C /etc/nixos status --porcelain | wc -l`
|
changes=$(git -C /etc/nixos status --porcelain | wc -l)
|
||||||
|
if [ "$changes" -gt 0 ]; then
|
||||||
if [ $changes -gt 0 ]; then
|
printf '\e[01;31m\n' >&2
|
||||||
echo -e '\e[01;31m' >&2
|
printf '######################################\n' >&2
|
||||||
echo -e '######################################' >&2
|
printf '# NixOS-config-Repo is not commited! #\n' >&2
|
||||||
echo -e '# NixOS-config-Repo is not commited! #' >&2
|
printf '######################################\n' >&2
|
||||||
echo -e '######################################' >&2
|
printf '\e[0m\n' >&2
|
||||||
echo -e '\e[0m' >&2
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue