This repository was archived by the owner on May 20, 2024. It is now read-only.
File tree 8 files changed +133
-64
lines changed
8 files changed +133
-64
lines changed Original file line number Diff line number Diff line change 26
26
# shellcheck source=basic/esc.inc.sh
27
27
. " $INCLUDE_PSST /basic/esc.inc.sh"
28
28
29
+ # shellcheck source=basic/const.inc.sh
30
+ . " $INCLUDE_PSST /basic/const.inc.sh"
31
+
29
32
# shellcheck source=basic/conv.inc.sh
30
33
. " $INCLUDE_PSST /basic/conv.inc.sh"
31
34
35
+ # shellcheck source=basic/global.inc.sh
36
+ . " $INCLUDE_PSST /basic/global.inc.sh"
37
+
32
38
# shellcheck source=basic/ifs.inc.sh
33
39
. " $INCLUDE_PSST /basic/ifs.inc.sh"
34
40
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+
3
+ # Double include protection
4
+ case " ${INCLUDE_SEEN_PSST-} " in
5
+ * _const.inc.sh_* )
6
+ return
7
+ ;;
8
+ esac
9
+ INCLUDE_SEEN_PSST=" ${INCLUDE_SEEN_PSST-} _const.inc.sh_"
10
+
11
+
12
+ # #
13
+ # CONSTANT
14
+ # NL_CHAR_PSST
15
+ #
16
+ # SUMMARY
17
+ # Newline (`\n`) character as string.
18
+ #
19
+ NL_CHAR_PSST=$( printf " \n_" )
20
+ NL_CHAR_PSST=${NL_CHAR_PSST% _}
21
+ # shellcheck disable=SC2034
22
+ readonly NL_CHAR_PSST
23
+
24
+
25
+ # #
26
+ # CONSTANT
27
+ # FS_CHAR_PSST
28
+ #
29
+ # SUMMARY
30
+ # FS (file separator) character (28/0x1c) as string.
31
+ #
32
+ # shellcheck disable=SC2034
33
+ FS_CHAR_PSST=$( printf " \34" )
34
+ # shellcheck disable=SC2034
35
+ readonly FS_CHAR_PSST
36
+
37
+
38
+ # #
39
+ # CONSTANT
40
+ # GS_CHAR_PSST
41
+ #
42
+ # SUMMARY
43
+ # GS (group separator) character (29/0x1D) as string.
44
+ #
45
+ # shellcheck disable=SC2034
46
+ GS_CHAR_PSST=$( printf " \35" )
47
+ # shellcheck disable=SC2034
48
+ readonly GS_CHAR_PSST
49
+
50
+
51
+ # #
52
+ # CONSTANT
53
+ # RS_CHAR_PSST
54
+ #
55
+ # SUMMARY
56
+ # RS (record separator) character (30/0x1E) as string.
57
+ #
58
+ # shellcheck disable=SC2034
59
+ RS_CHAR_PSST=$( printf " \36" )
60
+ # shellcheck disable=SC2034
61
+ readonly RS_CHAR_PSST
62
+
63
+
64
+ # #
65
+ # CONSTANT
66
+ # US_CHAR_PSST
67
+ #
68
+ # SUMMARY
69
+ # US (unit separator) character (31/0x1F) as string.
70
+ #
71
+ # shellcheck disable=SC2034
72
+ US_CHAR_PSST=$( printf " \37" )
73
+ # shellcheck disable=SC2034
74
+ readonly US_CHAR_PSST
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+
3
+ # Double include protection
4
+ case " ${INCLUDE_SEEN_PSST-} " in
5
+ * _global.inc.sh_* )
6
+ return
7
+ ;;
8
+ esac
9
+ INCLUDE_SEEN_PSST=" ${INCLUDE_SEEN_PSST-} _global.inc.sh_"
10
+
11
+
12
+ # #
13
+ # function
14
+ # global_update_term_width_psst
15
+ #
16
+ # SUMMARY
17
+ # Update the cached terminal width.
18
+ #
19
+ global_update_term_width_psst ()
20
+ {
21
+ if [ -n " ${COLUMNS-} " ]
22
+ then
23
+ TERM_WIDTH_PSST=" $COLUMNS "
24
+ elif tput cols > /dev/null 2>&1
25
+ then
26
+ # shellcheck disable=SC2034
27
+ TERM_WIDTH_PSST=$( tput cols )
28
+ fi
29
+ }
30
+
31
+
32
+ # #
33
+ # VARIABLE
34
+ # TERM_WIDTH_PSST
35
+ #
36
+ # SUMMARY
37
+ # Cached terminal width.
38
+ # It's cached as it's unlikely to change while a script is executing.
39
+ # Falls back to 80 in case real width cannot be determined.
40
+ #
41
+ # shellcheck disable=SC2034
42
+ TERM_WIDTH_PSST=80
43
+ global_update_term_width_psst
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
INCLUDE_SEEN_PSST=" ${INCLUDE_SEEN_PSST-} _print.inc.sh_"
10
10
11
11
12
- # shellcheck source=globals .inc.sh
13
- . " $INCLUDE_PSST /basic/globals .inc.sh"
12
+ # shellcheck source=global .inc.sh
13
+ . " $INCLUDE_PSST /basic/global .inc.sh"
14
14
15
15
16
16
# #
@@ -40,7 +40,7 @@ print_psst()
40
40
string=" $* "
41
41
42
42
lines=$( printf " %s\n" " $string " \
43
- | fold -w " $TERMINAL_WIDTH_PSST " -s \
43
+ | fold -w " $TERM_WIDTH_PSST " -s \
44
44
| sed " s/ $//"
45
45
)
46
46
printf " %s\n" " $lines "
@@ -79,7 +79,7 @@ print_i_psst()
79
79
IFS=" "
80
80
string=" $* "
81
81
82
- cols=$(( TERMINAL_WIDTH_PSST - indent ))
82
+ cols=$(( TERM_WIDTH_PSST - indent ))
83
83
lines=$( printf " %s\n" " $string " \
84
84
| fold -w " $cols " -s \
85
85
| sed " s/ $//"
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ INCLUDE_SEEN_PSST="${INCLUDE_SEEN_PSST-} _glob.inc.sh_"
12
12
# shellcheck source=../basic/assert.inc.sh
13
13
. " $INCLUDE_PSST /basic/assert.inc.sh"
14
14
15
- # shellcheck source=../basic/globals .inc.sh
16
- . " $INCLUDE_PSST /basic/globals .inc.sh"
15
+ # shellcheck source=../basic/global .inc.sh
16
+ . " $INCLUDE_PSST /basic/global .inc.sh"
17
17
18
18
# shellcheck source=../basic/ifs.inc.sh
19
19
. " $INCLUDE_PSST /basic/ifs.inc.sh"
Original file line number Diff line number Diff line change 42
42
# shellcheck source=../../../lib/psst/basic.inc.sh
43
43
. " $INCLUDE_PSST /basic.inc.sh"
44
44
45
- [ " $TERMINAL_WIDTH_PSST " = " 30" ] || test_fail_psst $LINENO
45
+ [ " $TERM_WIDTH_PSST " = " 30" ] || test_fail_psst $LINENO
46
46
)
47
47
48
48
53
53
# shellcheck source=../../../lib/psst/basic.inc.sh
54
54
. " $INCLUDE_PSST /basic.inc.sh"
55
55
56
- [ " $TERMINAL_WIDTH_PSST " = " $( tput cols ) " ] || test_fail_psst $LINENO
56
+ [ " $TERM_WIDTH_PSST " = " $( tput cols ) " ] || test_fail_psst $LINENO
57
57
)
58
58
fi
59
59
Original file line number Diff line number Diff line change 43
43
# shellcheck source=../../../lib/psst/basic.inc.sh
44
44
. " $INCLUDE_PSST /basic.inc.sh"
45
45
46
- [ " $TERMINAL_WIDTH_PSST " = " 30" ] || test_fail_psst $LINENO
46
+ [ " $TERM_WIDTH_PSST " = " 30" ] || test_fail_psst $LINENO
47
47
)
48
48
49
49
54
54
# shellcheck source=../../../lib/psst/basic.inc.sh
55
55
. " $INCLUDE_PSST /basic.inc.sh"
56
56
57
- [ " $TERMINAL_WIDTH_PSST " = " $( tput cols ) " ] || test_fail_psst $LINENO
57
+ [ " $TERM_WIDTH_PSST " = " $( tput cols ) " ] || test_fail_psst $LINENO
58
58
)
59
59
fi
60
60
You can’t perform that action at this time.
0 commit comments