-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_output
More file actions
73 lines (58 loc) · 2.07 KB
/
lib_output
File metadata and controls
73 lines (58 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# vim: set shiftwidth=4 softtabstop=4 expandtab foldlevel=0 foldmethod=indent: # vim-modline, don't delete
#############################################################################
# $HGFile: usr/local/lib64/lib_output $
# $HGLocation: /root/src/main $
# 1st Author: Massimo Burcheri
# Created: 2012-03-29
# $HGChecked in by: massimo $
# $HGDate: 2013-07-26 07:42 +0200 $
# $HGRevision: 567 $
# $HGBranch: padmburcheri1-linux $
# $HGDesc: updates $
#############################################################################
# Avoid multiple sourcing #START ################
script_id="${BASH_SOURCE##*/}"
script_id="${script_id%%.*}"
eval [[ -n \${SOURCED_${script_id}} ]] && return
#################################################
# Libraries
libs=( colors )
for lib in "${libs[@]}"; do
lib_path="${BASH_PREFIX:-/}usr/local/lib/lib_$lib"
[[ -e "$lib_path" ]] || { echo "$lib_path not found" 1>&2; exit 1; }
source "$lib_path"
done
success() {
printf "[${SOURCED_lib_colors:+$COLOR_GREEN}OK${SOURCED_lib_colors:+$COLOR_NONE}] %s\n" "$@" >&2
}
success_n() {
printf "[${SOURCED_lib_colors:+$COLOR_GREEN}OK${SOURCED_lib_colors:+$COLOR_NONE}] %s" "$@" >&2
}
debug() {
[[ -n $opt_debug ]] && printf "[${SOURCED_lib_colors:+$COLOR_BLUE}DEBUG${SOURCED_lib_colors:+$COLOR_NONE}] %s\n" "$@" >&2
}
debug_n() {
[[ -n $opt_debug ]] && printf "[${SOURCED_lib_colors:+$COLOR_BLUE}DEBUG${SOURCED_lib_colors:+$COLOR_NONE}] %s" "$@" >&2
}
error() {
printf "[${SOURCED_lib_colors:+$COLOR_RED}ERROR${SOURCED_lib_colors:+$COLOR_NONE}] %s\n" "$@" >&2
}
error_n() {
printf "[${SOURCED_lib_colors:+$COLOR_RED}ERROR${SOURCED_lib_colors:+$COLOR_NONE}] %s" "$@" >&2
}
warn() {
printf "[${SOURCED_lib_colors:+$COLOR_RED}WARN${SOURCED_lib_colors:+$COLOR_NONE}] %s\n" "$@" >&2
}
warn_n() {
printf "[${SOURCED_lib_colors:+$COLOR_RED}WARN${SOURCED_lib_colors:+$COLOR_NONE}] %s" "$@" >&2
}
die () {
local st="$?"
error "$@"
exit "$st"
}
export error
# Avoid multiple sourcing #END ##################
eval export SOURCED_${script_id}=1
#################################################