File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,25 @@ function log_tree() {
34
34
fi
35
35
}
36
36
37
+ # Helper for showing the contents of a file (using bat, if installed)
38
+ function log_file_bat() {
39
+ declare file=" ${1} "
40
+ shift
41
+ declare level=" ${1} "
42
+ shift
43
+ [[ " ${level} " == " debug" && " ${DEBUG} " != " yes" ]] && return # Skip debugs unless DEBUG=yes is set in the environment
44
+ log " ${level} " " ${@ } " " -- file ${file} :"
45
+ declare extra_bat_args=()
46
+ if [[ -n " ${bat_language} " ]]; then
47
+ extra_bat_args+=(" --language=${bat_language} " )
48
+ fi
49
+ if command -v bat > /dev/null; then
50
+ bat --color=always " ${extra_bat_args[@]} " " ${file} "
51
+ else
52
+ log " ${level} " " 'bat' utility not installed; install it to see file contents in logs."
53
+ fi
54
+ }
55
+
37
56
function install_dependencies() {
38
57
declare extra=" ${1} "
39
58
You can’t perform that action at this time.
0 commit comments