From 51f73ccc020080a0a42e8ca8fa9a7eb1af22d986 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Sat, 26 Feb 2022 17:34:33 -0800 Subject: [PATCH] feat: add module_print to module.lib will print the source of requested module --- module.lib | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/module.lib b/module.lib index d9adf0c..c45a97d 100644 --- a/module.lib +++ b/module.lib @@ -76,11 +76,21 @@ local FILE FILE=$(module_find $1) [ $? -ne 0 ] && echo no module $1 found && return 1 # source $FILE "$0" -[[ $BASHPID -eq $$ ]] || echo $FILE +# [[ $BASHPID -eq $$ ]] || echo $FILE source $FILE return 0 } +module_print() { +[ ! $1 ] && echo "no module specified" && return 1 +# (return 0 2>/dev/null) && echo "module_load was sourced" || echo "module_log was executed" +local FILE +FILE=$(module_find $1) +[ $? -ne 0 ] && echo no module $1 found && return 1 +cat $FILE +return 0 +} + module_loaded() { [ ! $1 ] && echo "no module specified" && return 1 local func