Outputs Front-Mater formatted failures for Bash functions not returning 0
exit status.
See the
example
Gitbranch
for usage examples.
Bash version ~4.3 or greater and the following command line utilities;
-
printf
for returning values between functions -
local
with-n
and-a
options available for passing references to variables between functions and assigning local arrays -
set
is utilizingset -E -o functrace
or similar prior to setting failuretrap
See
info printf
for documentation andhelp local
/help set
for more information on additional options.
Add one of the available clone
URLs to a current project...
cd your-project
_url='https://github.com/bash-utilities/trap-failure.git'
_dir='modules/trap-failure'
git submodule add -b master "${_url}" "${_dir}"
Older versions of
git
may require the following to populate${_dir}
...
git submodule update --init --recursive
Check that something similar to the following results from git status
...
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: .gitmodules
new file: modules/trap-failure
... commit
and push
these changes then notify anyone contributing to your project that...
git submodule update --init --recursive
git submodule update --merge
... commands may be useful for updating.
Tip, those that make a fresh
clone
of your project may use...
git clone --recurse-submodules <your-repositorys-url>
... to set-up all the various submodules that your project utilizes.
Note, if at any point in the future
git submodule foreach git status
reports a detachedHEAD
, and that is somehow bothersome then try...
cd modules/trap-failure
git checkout master
git pull
... to re-attach the submodule's
HEAD
once again.
Bash Trap Failure documentation on a submodule for Git tracked Bash scripts
Copyright (C) 2019 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.