Chore: Do not execute any code when forgit is sourced (#464)

In order to run unit tests for individual functions we have to be able
to source the script without triggering the main execution flow.
This commit is contained in:
carlfriedrich 2025-09-06 13:25:23 +02:00
parent d5961bee7e
commit a27da47aa5

View file

@ -1270,4 +1270,10 @@ PRIVATE_COMMANDS=(
"pager"
)
# Check if the script is being sourced. This is necessary for unit tests where
# we do not want to execute the main function.
if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
return 0
fi
main "${@}"