bashcov icon indicating copy to clipboard operation
bashcov copied to clipboard

[question] bash 'compiler'

Open hrpatel opened this issue 5 years ago • 0 comments

Hello,

We maintain a shell 'standard library' that we use across our projects: https://github.com/sdelements/shtdlib/blob/master/shtdlib.sh

If a script sources shtdlib.sh, would it be possible to use bashcov to determine which functions of shtdlib.sh were used and export/write those functions to a file?

E.g. the script below would generate a smaller file that only contains the debug, assert and color_echo (called from debug and assert) functions.

# Import the shell standard library
source /bin/shtdlib.sh

debug 10 "Running as ${UID:-$(id -u)}"

assert test -d "${script_dir}/build"
assert test -d "${script_dir}/dist"

hrpatel avatar Sep 17 '20 13:09 hrpatel