Skip to content

Commit 942a056

Browse files
committed
Allowing the use of sourcing installed commands
1 parent b846e32 commit 942a056

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/link-programs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ bpm::linkPrograms() {
4848
cat > "$2/$src" <<EOF
4949
#!/usr/bin/env bash
5050
# Generated command file for bpm
51-
"$libFolderResolved/$dest" \${@+"\$@"}
51+
bpm::isSourced() {
52+
[[ "\${FUNCNAME[1]-}" == "source" ]]
53+
}
54+
55+
if bpm::isSourced; then
56+
. "$libFolderResolved/$dest" ${@+"$@"}
57+
else
58+
"$libFolderResolved/$dest" ${@+"$@"}
59+
fi
5260
EOF
5361
chmod 755 "$2/$src"
5462
done

0 commit comments

Comments
 (0)