Skip to content

Commit b4dfdef

Browse files
committed
all functions to _bashy_*
1 parent 9870ee8 commit b4dfdef

File tree

11 files changed

+45
-45
lines changed

11 files changed

+45
-45
lines changed

bashy.bash

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function _bashy_load_plugins() {
108108
else
109109
bashy_array_found+=(0)
110110
bashy_array_filename+=(0)
111-
bashy_array_function+=(0)
111+
_bashy_array_function+=(0)
112112
bashy_array_source+=("---")
113113
continue
114114
fi
@@ -120,7 +120,7 @@ function _bashy_load_plugins() {
120120
source_absolute "${current_filename}"
121121
bashy_array_source+=($?)
122122
else
123-
bashy_array_function+=(0)
123+
_bashy_array_function+=(0)
124124
bashy_array_source+=("---")
125125
fi
126126
((i++))
@@ -138,7 +138,7 @@ function _bashy_load_config() {
138138
}
139139

140140
function _bashy_run_plugins() {
141-
for function in "${bashy_array_function[@]}"
141+
for function in "${_bashy_array_function[@]}"
142142
do
143143
if [[ "${function}" = 0 ]]
144144
then
@@ -178,13 +178,13 @@ function _bashy_run_plugins() {
178178
function bashy_status_core() {
179179
for name in "${bashy_core_names[@]}"
180180
do
181-
cecho gr "${name}" 1
181+
_bashy_cecho gr "${name}" 1
182182
res="${bashy_core_res[${i}]}"
183183
if [ "${res}" = 0 ]
184184
then
185-
cecho g "\tOK" 0
185+
_bashy_cecho g "\tOK" 0
186186
else
187-
cecho r "\tERROR" 0
187+
_bashy_cecho r "\tERROR" 0
188188
fi
189189
done | column -t
190190
}
@@ -198,43 +198,43 @@ function bashy_status_plugins() {
198198
((i=0))
199199
for plugin in "${bashy_array_plugin[@]}"
200200
do
201-
cecho gr "${plugin}" 1
201+
_bashy_cecho gr "${plugin}" 1
202202
local enabled="${bashy_array_enabled[${i}]}"
203203
if [[ "${enabled}" = 1 ]]
204204
then
205-
cecho g "\tEN" 1
205+
_bashy_cecho g "\tEN" 1
206206
else
207-
cecho y "\tDI" 1
207+
_bashy_cecho y "\tDI" 1
208208
fi
209209
local found="${bashy_array_found[${i}]}"
210210
if [[ "${found}" = 1 ]]
211211
then
212-
cecho g "\tFOUND_OK" 1
212+
_bashy_cecho g "\tFOUND_OK" 1
213213
else
214-
cecho r "\tFOUND_ERROR" 1
214+
_bashy_cecho r "\tFOUND_ERROR" 1
215215
fi
216216
# local filename="${bashy_array_filename[${i}]}"
217217
# if [[ $filename = 0 ]]
218218
# then
219-
# cecho r "\tNO_FILENAME" 1
219+
# _bashy_cecho r "\tNO_FILENAME" 1
220220
# else
221-
# cecho gr "\t${filename}" 1
221+
# _bashy_cecho gr "\t${filename}" 1
222222
# fi
223223
if [[ "${enabled}" = 1 ]]
224224
then
225225
local source="${bashy_array_source[${i}]}"
226226
if [[ "${source}" = 0 ]]
227227
then
228-
cecho g "\tLOAD_OK" 1
228+
_bashy_cecho g "\tLOAD_OK" 1
229229
else
230-
cecho r "\tLOAD_ERROR" 1
230+
_bashy_cecho r "\tLOAD_ERROR" 1
231231
fi
232232
local result="${bashy_array_result[${i}]}"
233233
if [[ "${result}" = 0 ]]
234234
then
235-
cecho g "\tRESULT_OK" 1
235+
_bashy_cecho g "\tRESULT_OK" 1
236236
else
237-
cecho r "\tRESULT_ERROR" 1
237+
_bashy_cecho r "\tRESULT_ERROR" 1
238238
fi
239239
if is_profile
240240
then
@@ -244,9 +244,9 @@ function bashy_status_plugins() {
244244
echo
245245
fi
246246
else
247-
cecho y "\tNOT_LOADED" 1
248-
cecho y "\tNO_RESULT" 1
249-
cecho y "\tNO_TIME" 0
247+
_bashy_cecho y "\tNOT_LOADED" 1
248+
_bashy_cecho y "\tNO_RESULT" 1
249+
_bashy_cecho y "\tNO_TIME" 0
250250
fi
251251
((i++))
252252
done | column -t
@@ -260,7 +260,7 @@ function bashy_errors() {
260260
local error="${bashy_array_error[${i}]}"
261261
if [ "${error}" != "" ]
262262
then
263-
cecho r "${plugin} - ${error}\n" 1
263+
_bashy_cecho r "${plugin} - ${error}\n" 1
264264
fi
265265
((i++))
266266
done

core/assoc.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function assoc_get() {
5252
then
5353
__var=${__assoc_get[${key}]}
5454
else
55-
null_set_value __var
55+
_bashy_null_set_value __var
5656
fi
5757
}
5858

core/color.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# a set of bash functions to help with color printing
22

3-
function cecho() {
3+
function _bashy_cecho() {
44
local color=$1
55
local text=$2
66
local newline=$3

core/hooks.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# hook subsystem of bashy
22

3-
array_new bashy_array_function
4-
assoc_new bashy_assoc_function
3+
array_new _bashy_array_function
4+
assoc_new _bashy_assoc_function
55

66
function register_core() {
77
local _function=$1
88
local _name=$2
9-
assoc_assert_key_not_exists bashy_assoc_function "${_function}"
10-
array_push bashy_array_function "${_function}"
11-
assoc_set bashy_assoc_function "${_function}" "${_name}"
9+
assoc_assert_key_not_exists _bashy_assoc_function "${_function}"
10+
array_push _bashy_array_function "${_function}"
11+
assoc_set _bashy_assoc_function "${_function}" "${_name}"
1212
}
1313

1414
function register() {

core/null.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# This is my own invention of a NULL value is bash.
1+
# This is my own invention of a NULL value in bash.
22
# for my purposes it is enough to say that NULL is just the string "NULL"
33
# in bash. This will do for now.
44

5-
function null_is_null() {
5+
function _bashy_null_is_null() {
66
local value=$1
77
[ "${value}" = "NULL" ]
88
}
99

10-
function null_var_is_null() {
10+
function _bashy_null_var_is_null() {
1111
local -n value=$1
1212
[ "${value}" = "NULL" ]
1313
}
1414

15-
function null_isnt_null() {
15+
function _bashy_null_isnt_null() {
1616
local value=$1
1717
[ "${value}" != "NULL" ]
1818
}
1919

20-
function null_set_value() {
20+
function _bashy_null_set_value() {
2121
local -n __var_null=$1
2222
__var_null="NULL"
2323
}

plugins/aws_prompt.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function aws_prompt() {
3535
assoc_get aws_conf aws_configuration_name "aws_configuration_name"
3636

3737
# set the envrionment variable
38-
if null_is_null "${aws_configuration_name}"
38+
if _bashy_null_is_null "${aws_configuration_name}"
3939
then
4040
unset AWS_PROFILE
4141
else

plugins/gcp_prompt.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function gcp_prompt() {
3333
assoc_get gcp_conf gcp_configuration_name "gcp_configuration_name"
3434

3535
# set the envrionment variable
36-
if null_is_null "${gcp_configuration_name}"
36+
if _bashy_null_is_null "${gcp_configuration_name}"
3737
then
3838
unset CLOUDSDK_ACTIVE_CONFIG_NAME
3939
else

plugins/myenv_prompt.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function myenv_print_debug() {
106106
function myenv_info() {
107107
local msg=$1
108108
# echo "myenv: info: ${msg}"
109-
cecho g "myenv: info: ${msg}" 0
109+
_bashy_cecho g "myenv: info: ${msg}" 0
110110
}
111111

112112
function myenv_create_virtualenv() {
@@ -214,7 +214,7 @@ function myenv_in_virtual_env() {
214214

215215
function myenv_error() {
216216
# echo "$1"
217-
cecho r "myenv: error: $1" 0
217+
_bashy_cecho r "myenv: error: $1" 0
218218
}
219219

220220
function myenv_deactivate_real() {

plugins/pydmt_prompt.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ function pydmt_debug_off() {
4646
function pydmt_info() {
4747
local msg=$1
4848
# echo "pydmt: info: ${msg}"
49-
cecho g "pydmt: info: ${msg}" 0
49+
_bashy_cecho g "pydmt: info: ${msg}" 0
5050
}
5151

5252
function pydmt_error() {
53-
cecho r "pydmt: error: ${1}" 0
53+
_bashy_cecho r "pydmt: error: ${1}" 0
5454
}
5555

5656
function pydmt_prompt() {

test_all.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ do
2727
("${name}") || res=${?}
2828
if [ "${res}" == "0" ]
2929
then
30-
cecho g "OK" 0
30+
_bashy_cecho g "OK" 0
3131
(( count_ok+=1 ))
3232
else
33-
cecho r "ERROR" 0
33+
_bashy_cecho r "ERROR" 0
3434
(( count_er+=1 ))
3535
fi
3636
fi
3737
done
3838
echo "summary"
3939
echo "number of tests run --> ${count}"
4040
echo -n "number of tests ok --> "
41-
cecho g "${count_ok}" 0
41+
_bashy_cecho g "${count_ok}" 0
4242
echo -n "number of tests failed --> "
4343
if [ "${count_er}" -eq 0 ]
4444
then
45-
cecho g "${count_er}" 0
45+
_bashy_cecho g "${count_er}" 0
4646
exit 0
4747
else
48-
cecho r "${count_er}" 0
48+
_bashy_cecho r "${count_er}" 0
4949
exit 1
5050
fi

0 commit comments

Comments
 (0)