summaryrefslogtreecommitdiff
path: root/bin/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pkg')
-rwxr-xr-xbin/pkg49
1 files changed, 22 insertions, 27 deletions
diff --git a/bin/pkg b/bin/pkg
index 09c82d2..c27d1f5 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -18,28 +18,10 @@ setopt extended_glob
typeset -a -U triggers
typeset -a CL_OPTIONS
-##
-## Internal functions for displaying stuff
-##
-
c_info=$'\e[0;36m'
c_error=$'\e[0;31m'
c_reset=$'\e[0m'
-function debug {
- typeset func line
- if (( $# >= 3 )) {
- func=$1
- line=$2
- shift 2
- }
- echo "(debug) $func:$line: $*" >&2
-}
-
-# I need function name and line number of the function _calling_ debug,
-# so I can't get them from inside the debug function.
-alias debug='debug ${(z%):-%N %i}'
-
function info {
echo -ne "${c_info}$*${c_reset}"
}
@@ -57,14 +39,6 @@ function say {
echo $*
}
-function check_installed {
- [[ -n $1 && -d $PKG_DIR/$1 ]] || die "Package not installed: '$1'\n"
-}
-
-function check_valid {
- list_exists $1 || die "Package does not exist: '$1'\n"
-}
-
function clear_line {
echo -ne "\r\e[2K"
}
@@ -107,6 +81,20 @@ shift
export PKG_DIR
export PKG_ROOT
+function debug {
+ typeset func line
+ if (( $# >= 3 )) {
+ func=$1
+ line=$2
+ shift 2
+ }
+ echo "(debug) $func:$line: $*" >&2
+}
+
+# I need function name and line number of the function _calling_ debug,
+# so I can't get them from inside the debug function.
+alias debug='debug ${(z%):-%N %i}'
+
# Avoid calling debug without debug mode... just in case one needs more speed
if (( !DEBUG )) {
unalias debug
@@ -122,7 +110,6 @@ if (( SILENT )) {
function clear_line {}
}
-
if [[ ! -d $PKG_DIR ]] {
die "Error: Package directory '$PKG_DIR' not found\n"
}
@@ -176,6 +163,14 @@ if ((DEBUG)) {
echo " GIT_USE_ORIGIN $GIT_USE_ORIGIN"
}
+function check_installed {
+ [[ -n $1 && -d $PKG_DIR/$1 ]] || die "Package not installed: '$1'\n"
+}
+
+function check_valid {
+ list_exists $1 || die "Package does not exist: '$1'\n"
+}
+
# Default reply: Yes
function confirm_yes {
echo -n "$* [Y/n] "