summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zsh/utils24
-rw-r--r--.zsh/zshenv/01_path24
2 files changed, 25 insertions, 23 deletions
diff --git a/.zsh/utils b/.zsh/utils
index fd81acd..1097637 100644
--- a/.zsh/utils
+++ b/.zsh/utils
@@ -7,6 +7,30 @@
#
# Source repository: git://git.distanz.ch/dotfiles/zsh.git
+# prepend custom directory to $PATH
+path_prepend()
+{
+ local dir
+ for dir; do
+ case "$PATH" in
+ "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;;
+ *) test -d "$dir" && path=("$dir" $path);;
+ esac
+ done
+}
+
+# append custom directory to $PATH
+path_append()
+{
+ local dir
+ for dir; do
+ case "$PATH" in
+ "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;;
+ *) test -d "$dir" && path+="$dir";;
+ esac
+ done
+}
+
# are we root?
is_root() {
test ${EUID:?} -eq 0
diff --git a/.zsh/zshenv/01_path b/.zsh/zshenv/01_path
index 4f402dd..035a83d 100644
--- a/.zsh/zshenv/01_path
+++ b/.zsh/zshenv/01_path
@@ -1,6 +1,6 @@
# zshenv/01_path
#
-# Functions to add custom directories to the $PATH
+# Add custom directories to the $PATH
#
# Copyright © 2011-2013 Tobias Klauser <tklauser@distanz.ch>
# Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
@@ -8,28 +8,6 @@
#
# Source repository: git://git.distanz.ch/dotfiles/zsh.git
-path_prepend()
-{
- local dir
- for dir; do
- case "$PATH" in
- "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;;
- *) test -d "$dir" && path=("$dir" $path);;
- esac
- done
-}
-
-path_append()
-{
- local dir
- for dir; do
- case "$PATH" in
- "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;;
- *) test -d "$dir" && path+="$dir";;
- esac
- done
-}
-
# add the paths here
path_prepend $HOME/.local/bin