-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash-doc-init
More file actions
51 lines (44 loc) · 1.87 KB
/
bash-doc-init
File metadata and controls
51 lines (44 loc) · 1.87 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
#!/usr/bin/env bash
if [ -n "${__bash_doc_included__}" ]; then
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
return 0
else
exit 0
fi
fi
export __bash_doc_included__=true
if [ -z "${BASH_DOC_DIR}" ]; then
current_file=
if [ -n "$BASH_VERSION" ]; then
current_file="${BASH_SOURCE[0]}"
elif [ -n "$ZSH_VERSION" ]; then
current_file="${(%):-%x}"
fi
BASH_DOC_DIR="$(dirname $(readlink -f "${current_file}"))"
fi
# ===================== > Source and export functions < ====================== #
source ${BASH_DOC_DIR}/functions/check_arguments
source ${BASH_DOC_DIR}/functions/err
source ${BASH_DOC_DIR}/functions/format_functions
source ${BASH_DOC_DIR}/functions/format_help
source ${BASH_DOC_DIR}/functions/indent
source ${BASH_DOC_DIR}/functions/init_functions
source ${BASH_DOC_DIR}/functions/max
source ${BASH_DOC_DIR}/functions/need_help
source ${BASH_DOC_DIR}/functions/newline
source ${BASH_DOC_DIR}/functions/parse_arguments
source ${BASH_DOC_DIR}/functions/rep
source ${BASH_DOC_DIR}/functions/show_help
source ${BASH_DOC_DIR}/functions/source_chain
# ────────────────────────────────── <end> ─────────────────────────────────── #
# ========================= > Export all functions < ========================= #
eval "$(declare -F |
perl -p0e "s/declare\s+-f\s+(.*)\s*$/export -f \${1}/gmi" )"
# ────────────────────────────────── <end> ─────────────────────────────────── #
export __bash_doc_output_redirected__="false"
(command -v "tput" >/dev/null 2>&1) &&
{
export __bash_doc_has_tput__="true"
} || {
export __bash_doc_has_tput__="false"
}