File tree Expand file tree Collapse file tree 6 files changed +29
-31
lines changed Expand file tree Collapse file tree 6 files changed +29
-31
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,7 @@ examples:
5050# # before running anything else.
5151# #
5252# # You can safely delete this file if you do not need it.
53- trap 'stacktrace' ERR
54- set -o errtrace
53+ enable_stacktrace
5554
5655````
5756
@@ -118,8 +117,8 @@ Examples:
118117
119118Stack trace:
120119 from ./download:15 in ` root_command`
121- from ./download:254 in ` run`
122- from ./download:260 in ` main`
120+ from ./download:260 in ` run`
121+ from ./download:266 in ` main`
123122
124123
125124````
Original file line number Diff line number Diff line change 44# # before running anything else.
55# #
66# # You can safely delete this file if you do not need it.
7- trap ' stacktrace' ERR
8- set -o errtrace
7+ enable_stacktrace
Original file line number Diff line number Diff line change 44# # Usage:
55# # This function is designed to be called on error.
66# #
7- # # To enable this functionality, add these lines to your `src/initialize.sh`
8- # # file (Run `bashly add hooks` to add this file):
9- # #
10- # # trap 'stacktrace' ERR
11- # # set -o errtrace
12- # #
13- # # Note that this functionality also requires `set -e`, which is enabled by
14- # # default in bashly generated scripts.
7+ # # To enable this functionality, call `enable_stacktrace` in your
8+ # # `src/initialize.sh` (Run `bashly add hooks` to add this file).
159# #
10+ enable_stacktrace () {
11+ trap ' stacktrace' ERR
12+ set -o errtrace
13+ set -o errexit
14+ }
15+
1616stacktrace () {
1717 local exit_status=" $? "
1818 local i=0
Original file line number Diff line number Diff line change @@ -110,10 +110,10 @@ stacktrace:
110110 post_install_message : |
111111 The stacktrace function is designed to be called automatically on error.
112112
113- To enable this functionality, add these lines to your `initialize.sh`:
114-
115- g`trap 'stacktrace' ERR`
116- g`set -o errtrace `
113+ To enable this functionality, call g`enable_stacktrace` in your
114+ g`src/initialize.sh`. You may run the following command to add this file:
115+
116+ m`$ bashly add hooks `
117117
118118strings :
119119 help : Copy an additional configuration file to your project, allowing you to customize all the tips and error strings.
Original file line number Diff line number Diff line change 44# # Usage:
55# # This function is designed to be called on error.
66# #
7- # # To enable this functionality, add these lines to your `src/initialize.sh`
8- # # file (Run `bashly add hooks` to add this file):
9- # #
10- # # trap 'stacktrace' ERR
11- # # set -o errtrace
12- # #
13- # # Note that this functionality also requires `set -e`, which is enabled by
14- # # default in bashly generated scripts.
7+ # # To enable this functionality, call `enable_stacktrace` in your
8+ # # `src/initialize.sh` (Run `bashly add hooks` to add this file).
159# #
10+ enable_stacktrace () {
11+ trap ' stacktrace' ERR
12+ set -o errtrace
13+ set -o errexit
14+ }
15+
1616stacktrace () {
1717 local exit_status=" $? "
1818 local i=0
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ created src/lib/stacktrace.sh
33
44The stacktrace function is designed to be called automatically on error.
55
6- To enable this functionality, add these lines to your `initialize.sh`:
6+ To enable this functionality, call enable_stacktrace in your
7+ src/initialize.sh. You may run the following command to add this file:
78
8- trap 'stacktrace' ERR
9- set -o errtrace
9+ $ bashly add hooks
1010
1111+ bashly generate
1212creating user files in src
@@ -51,5 +51,5 @@ Examples:
5151
5252Stack trace:
5353 from ./download:15 in `root_command`
54- from ./download:255 in `run`
55- from ./download:261 in `main`
54+ from ./download:260 in `run`
55+ from ./download:266 in `main`
You can’t perform that action at this time.
0 commit comments