Skip to content

Commit 80665f9

Browse files
committed
docs: Update deprecations and cleanups
1 parent 7d3220b commit 80665f9

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ Core functions for any Bash program
66

77
The following is a brief overview of the available functions. See [api.md](./docs/api.md) for more details
88

9-
### `trap`
9+
### trap
1010

1111
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
1212

1313
- `core.trap_add`
1414
- `core.trap_remove`
1515

16-
### `shopt`
16+
### shopt
1717

1818
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
1919

2020
- `core.shopt_push`
2121
- `core.shopt_pop`
2222

23-
### `err`
23+
### err
2424

2525
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
2626

2727
- `core.err_set`
2828
- `core.err_clear`
2929
- `core.err_exists`
3030

31-
### `print`
31+
### print
3232

3333
- `core.print_stacktrace`
3434
- `core.print_error`
@@ -37,22 +37,15 @@ It can look redundant (compared to `if ! fn; then :; fi`) to define error functi
3737

3838
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))
3939

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:
4841

4942
```txt
5043
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)
5649
```
5750

5851
## Installation

docs/api.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,14 @@ Print an informative message to standard output
210210

211211
### core.should_output_color()
212212

213-
Determine if color should be printed. Note that this doesn't
214-
use tput because simple environment variable checking heuristics suffice
213+
(DEPRECATED). Determine if color should be printed. Note that this doesn't
214+
use tput because simple environment variable checking heuristics suffice. Deprecated because this code
215+
has been moved to bash-std
215216

216217
### core.get_package_info()
217218

218-
Gets information from a particular package. If the key does not exist, then the value
219-
is an empty string
219+
(DEPRECATED) Gets information from a particular package. If the key does not exist, then the value
220+
is an empty string. Deprecated as this code has been moved to bash-std
220221

221222
#### Arguments
222223

pkg/src/public/bash-core.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ core.print_info() {
358358
printf '%s\n' "Info${msg:+": "}$msg"
359359
}
360360

361-
# @description Determine if color should be printed. Note that this doesn't
362-
# use tput because simple environment variable checking heuristics suffice
361+
# @description (DEPRECATED). Determine if color should be printed. Note that this doesn't
362+
# use tput because simple environment variable checking heuristics suffice. Deprecated because this code
363+
# has been moved to bash-std
363364
core.should_output_color() {
364365
# https://no-color.org
365366
if [ ${NO_COLOR+x} ]; then
@@ -390,8 +391,8 @@ core.should_output_color() {
390391
return 1
391392
}
392393

393-
# @description Gets information from a particular package. If the key does not exist, then the value
394-
# is an empty string
394+
# @description (DEPRECATED) Gets information from a particular package. If the key does not exist, then the value
395+
# is an empty string. Deprecated as this code has been moved to bash-std
395396
# @arg $1 string The `$BASALT_PACKAGE_DIR` of the caller
396397
# @set directory string The full path to the directory
397398
core.get_package_info() {

0 commit comments

Comments
 (0)