git-vendor-name: composure
git-vendor-dir: vendor/github.com/erichs/composure
git-vendor-repository: https://github.com/erichs/composure
git-vendor-ref: master
pull/2027/head
John D Pell 2022-01-08 09:25:13 -08:00
parent 86c1e3c043
commit d4b4995e2a
1 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@ _bootstrap_composure() {
_get_composure_dir () _get_composure_dir ()
{ {
if [ -n "$XDG_DATA_HOME" ]; then if [ -n "${XDG_DATA_HOME:-}" ]; then
echo "$XDG_DATA_HOME/composure" echo "$XDG_DATA_HOME/composure"
else else
echo "$HOME/.local/composure" echo "$HOME/.local/composure"
@ -30,7 +30,7 @@ _get_author_name ()
{ {
typeset name localname typeset name localname
localname="$(git --git-dir "$(_get_composure_dir)/.git" config --get user.name)" localname="$(git --git-dir "$(_get_composure_dir)/.git" config --get user.name)"
for name in "$GIT_AUTHOR_NAME" "$localname"; do for name in "${GIT_AUTHOR_NAME:-}" "$localname"; do
if [ -n "$name" ]; then if [ -n "$name" ]; then
echo "$name" echo "$name"
break break
@ -55,7 +55,7 @@ _letterpress ()
} }
_determine_printf_cmd() { _determine_printf_cmd() {
if [ -z "$_printf_cmd" ]; then if [ -z "${_printf_cmd:-}" ]; then
_printf_cmd=printf _printf_cmd=printf
# prefer GNU gprintf if available # prefer GNU gprintf if available
[ -x "$(which gprintf 2>/dev/null)" ] && _printf_cmd=gprintf [ -x "$(which gprintf 2>/dev/null)" ] && _printf_cmd=gprintf
@ -78,7 +78,7 @@ _longest_function_name_length ()
_temp_filename_for () _temp_filename_for ()
{ {
typeset file=$(mktemp "/tmp/$1.XXXX") typeset file="$(mktemp "/tmp/$1.XXXX")"
command rm "$file" 2>/dev/null # ensure file is unlinked prior to use command rm "$file" 2>/dev/null # ensure file is unlinked prior to use
echo "$file" echo "$file"
} }
@ -136,7 +136,7 @@ _transcribe ()
if [ -d "$composure_dir" ]; then if [ -d "$composure_dir" ]; then
_add_composure_file "$func" "$file" "$operation" "$comment" _add_composure_file "$func" "$file" "$operation" "$comment"
else else
if [ "$USE_COMPOSURE_REPO" = "0" ]; then if [ "${USE_COMPOSURE_REPO:-}" = "0" ]; then
return # if you say so... return # if you say so...
fi fi
printf "%s\n" "I see you don't have a $composure_dir repo..." printf "%s\n" "I see you don't have a $composure_dir repo..."
@ -223,7 +223,7 @@ _load_composed_functions () {
# you may disable this by adding the following line to your shell startup: # you may disable this by adding the following line to your shell startup:
# export LOAD_COMPOSED_FUNCTIONS=0 # export LOAD_COMPOSED_FUNCTIONS=0
if [ "$LOAD_COMPOSED_FUNCTIONS" = "0" ]; then if [ "${LOAD_COMPOSED_FUNCTIONS:-}" = "0" ]; then
return # if you say so... return # if you say so...
fi fi
@ -379,7 +379,7 @@ metafor ()
# 'grep' for the metadata keyword, and then parse/filter the matching line # 'grep' for the metadata keyword, and then parse/filter the matching line
# grep keyword # strip trailing '|"|; # ignore thru keyword and leading '|" # grep keyword # strip trailing '|"|; # ignore thru keyword and leading '|"
sed -n "/$keyword / s/['\";]*\$//;s/^[ ]*$keyword ['\"]*\([^([].*\)*\$/\1/p" sed -n "/$keyword / s/['\";]*\$//;s/^[ ]*\(: _\)*$keyword ['\"]*\([^([].*\)*\$/\2/p"
} }
reference () reference ()
@ -462,7 +462,7 @@ revise ()
cat "$composure_dir/$func.inc" > "$temp" cat "$composure_dir/$func.inc" > "$temp"
fi fi
if [ -z "$EDITOR" ] if [ -z "${EDITOR:-}" ]
then then
typeset EDITOR=vi typeset EDITOR=vi
fi fi