mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
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:
parent
9b3b185e24
commit
ab6a63ee0f
|
|
@ -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 "${@}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue