Skip to content

Commit

Permalink
Add sanity check to bin/bashlet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Reale committed Nov 11, 2016
1 parent 97f79f1 commit a9553d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/bashlet
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,16 @@ function bashlet_trace_disable()
}



# check if the script is sourced
[[ "${BASH_SOURCE[0]}" != "${0}" ]] || {
echo "[bashlets:FATAL] Loader script must be sourced!"
exit 1
}

# ``parse'' command line
[[ $# != 1 ]] && {
echo "Usage: bashlet <bashlet>" >&2
echo "[bashlets:FATAL] Loader usage: bashlet <BASHLET>" >&2
return 1
}

Expand All @@ -154,7 +161,7 @@ export BASHLETS_OSTYPE

# library entry point
bashlet_import "$1" || {
echo "Error!" >&2
echo "[bashlets:FATAL] Generic loader error." >&2
return 1
}

Expand Down

0 comments on commit a9553d0

Please sign in to comment.