You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-17Lines changed: 10 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -6,29 +6,29 @@ Core functions for any Bash program
6
6
7
7
The following is a brief overview of the available functions. See [api.md](./docs/api.md) for more details
8
8
9
-
### `trap`
9
+
### trap
10
10
11
11
Add or remove multiple functions at a time to any set of signals. Without these, it is impossible to trap a signal without erasing a previous one
12
12
13
13
-`core.trap_add`
14
14
-`core.trap_remove`
15
15
16
-
### `shopt`
16
+
### shopt
17
17
18
18
Enable or disable a shell option. Enabling a shell option adds it to a hidden stack. When that shell option is no longer needed, it should be removed by popping it from the stack
19
19
20
20
-`core.shopt_push`
21
21
-`core.shopt_pop`
22
22
23
-
### `err`
23
+
### err
24
24
25
25
It can look redundant (compared to `if ! fn; then :; fi`) to define error functions, but it can help make errors a bit more safe in larger applications, since you don't have to worry about a caller forgetting to `if ! fn` or `fn ||` (and terminating the script if `set -e`). It also makes it easier to communicate specific error codes and helps separate between calculated / expected errors and unexpected errors / faults
26
26
27
27
-`core.err_set`
28
28
-`core.err_clear`
29
29
-`core.err_exists`
30
30
31
-
### `print`
31
+
### print
32
32
33
33
-`core.print_stacktrace`
34
34
-`core.print_error`
@@ -37,22 +37,15 @@ It can look redundant (compared to `if ! fn; then :; fi`) to define error functi
37
37
38
38
The function `core.print_stacktrace` prints the stack trace. It is recommended to use this with `core.trap_add` (see [example](./docs/api.md#coreprint_stacktrace))
39
39
40
-
### Misc
41
-
42
-
Miscellaneous functions
43
-
44
-
-`core.panic()`
45
-
-`core.should_output_color()`
46
-
47
-
This is what it may look like
40
+
Following is a `core.print_stacktrace` example:
48
41
49
42
```txt
50
43
Stacktrace:
51
-
in core.stacktrace_print (/storage/ur/storage_home/Docs/Programming/repos/Groups/Bash/bash-core/.hidden/test.sh:0)
52
-
in err_handler (/storage/ur/storage_home/Docs/Programming/repos/Groups/Bash/bash-core/.hidden/test.sh:36)
53
-
in fn3 (/storage/ur/storage_home/Docs/Programming/repos/Groups/Bash/bash-core/.hidden/test.sh:48)
54
-
in fn2 (/storage/ur/storage_home/Docs/Programming/repos/Groups/Bash/bash-core/.hidden/test.sh:53)
55
-
in fn (/storage/ur/storage_home/Docs/Programming/repos/Groups/Bash/bash-core/.hidden/test.sh:57)
44
+
in core.stacktrace_print (/home/edwin/repos/bash-core/.hidden/test.sh:0)
45
+
in err_handler (/home/edwin/repos/bash-core/.hidden/test.sh:36)
46
+
in fn3 (/home/edwin/repos/bash-core/.hidden/test.sh:48)
47
+
in fn2 (/home/edwin/repos/bash-core/.hidden/test.sh:53)
48
+
in fn (/home/edwin/repos/bash-core/.hidden/test.sh:57)
0 commit comments