summaryrefslogtreecommitdiff
path: root/lua/snippets/sh/bash-misc.lua
blob: cafa944f36794b6aff52ea3c6c843e30f266c781 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
return {
   s({
      trig = "no-source",
      dscr = "Exit with an error if script is being sourced",
   }, {
      t({
         'if [[ "${0}" != "${BASH_SOURCE[0]}" ]]; then',
         '\techo "Error: script ${BASH_SOURCE[0]} is not supported to be sourced!"',
         "\treturn 1",
         "fi",
      }),
   }),
}