Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.0
2.7.1
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"compile-hero.disable-compile-files-on-did-save-code": true,
"shellcheck.enableQuickFix": true,
"workbench.colorTheme": "Kimbie Dark",
"window.zoomLevel": 0,
"workbench.colorTheme": "Frontier (rainglow)",
"window.zoomLevel": 1,
"customPresentationMode.backup": {},
"gruvboxMaterial.jsson1Comments": false,
"git-graph.markdown": false
Expand Down
Binary file modified README.pdf
Binary file not shown.
22 changes: 11 additions & 11 deletions bin/adoc2pdf
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ EOF
if [[ -f "${attrfile}" ]]; then
attributes="$(cat "${attrfile}")"
info "Adding attributes from local file ${bldylw}${attrfile}:">&2
cat ${attrfile}
cat "${attrfile}"
else
info "No local attribute file was found: ${bldylw}${attrfile}." >&2
fi
}

function install-fonts() {
(
cd ${BASHMATIC_HOME}
cd "${BASHMATIC_HOME}" || exit
[[ -d .fonts ]] || run "tar xvzf .fonts.tar.gz"
cd -
cd - || exit
) >/dev/null
}

Expand Down Expand Up @@ -86,7 +86,7 @@ function install-gems-manually() {
if [[ ${gem} =~ / ]]; then
run "gem specific_install ${gem} --silent"
else
gem.install ${gem}
gem.install "${gem}"
fi
done
}
Expand Down Expand Up @@ -116,9 +116,9 @@ main() {
info "Pre-pending PDF font configuration..."
(
sed -n '1p' "${file}"
adoc-header ${file}
adoc-header "${file}"
sed -n '2,$p' "${file}"
) >${temp}
) >"${temp}"
fi

info "Rendering ADOC file: ${bldylw}${temp}"
Expand All @@ -144,22 +144,22 @@ bundle exec --gemfile="${bashmatic_gemfile}" asciidoctor-pdf \\
--out-file ${target} \\
${temp} $*
EOF
) >${script}
) >"${script}"

info "Printing the complete asciidoctor-pdf command for debugging:\n"
printf -- "${txtylw}$(cat ${script})${clr}\n\n${txtgrn}"
printf -- "${txtylw}$(cat "${script}")${clr}\n\n${txtgrn}"
hr
local out=$(file.temp)
echo
inf "Generating PDF from ${file} to ${bldylw}${target}... please wait..."
local s=$(millis)
( bash ${script} ) >${out} 2>&1
( bash "${script}" ) >"${out}" 2>&1
local code=$?
local e=$(millis)
((code)) && {
not-ok:
error "Command exited with status code ${code}."
cat ${out}
cat "${out}"
return ${code}
}
duration $((e - s))
Expand All @@ -170,7 +170,7 @@ EOF
rm -f "${out} ${temp}"
echo
[[ -s ${target} ]] && \
success "File ${target} has been re-generated, and is of size $(file.size.mb ${target})"
success "File ${target} has been re-generated, and is of size $(file.size.mb "${target}")"

info "HINT: to reduce size of the PDF run ${bldgrn}pdf-reduce ${target}"
echo
Expand Down
4 changes: 2 additions & 2 deletions bin/ascii2utf8
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for f in $(find . -type f); do
# continue
#}

encoding="$(file --mime-encoding $f)"
encoding="$(file --mime-encoding "$f")"

[[ ${encoding} == "binary" ]] && {
printf "🗑 "
Expand All @@ -32,7 +32,7 @@ for f in $(find . -type f); do
continue
}

printf "%s,%s,%s\n" "${file}" "${encoding}" "iconv -f $encoding -t utf-8 $f -o $f" >>${output}
printf "%s,%s,%s\n" "${file}" "${encoding}" "iconv -f $encoding -t utf-8 $f -o $f" >>"${output}"
printf "🥳 "
continue
done
Expand Down
2 changes: 1 addition & 1 deletion bin/bashmatic
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ shift
if is.a-function "${__func}"; then
${__func} "$@"
elif is.a-function "bashmatic.${__func}"; then
bashmatic.${__func} "$@"
bashmatic."${__func}" "$@"
else
error "Can't find a valid function based on the argument ${bldylw}${__func}"
exit 1
Expand Down
6 changes: 3 additions & 3 deletions bin/dev-setup
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export DevSetup__Version="0.4.1"
[[ -d "${dir}" ]] || run "git clone https://github.com/rupa/z ${dir}"

for init in ${HOME}/.bash_profile ${HOME}/.zshrc; do
grep -q "${script}" ${init} || {
grep -q "${script}" "${init}" || {
info "Appending ${script} to ${init}..."
echo "[[ -s ${script} ]] && source ${script}" >>${init}
echo "[[ -s ${script} ]] && source ${script}" >>"${init}"
}
done

Expand Down Expand Up @@ -766,7 +766,7 @@ dev-setup.run-action() {
local action=".dev-setup.action.${action_name}"
set +e

is.a-function ${action} || {
is.a-function "${action}" || {
error "Invalid Dev Setup action ${action_name}" "function ${action} is not defined."
return 1
}
Expand Down
2 changes: 1 addition & 1 deletion bin/downloader
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ downloader.extract-image-urls() {
}

if [[ -f ${__downloader_tempfile} ]]; then
grep -E -i 'src="[^"].*\.(png|jpg|jpe?g|gif|tiff|svg|pdf|bmp)"' ${__downloader_tempfile} |
grep -E -i 'src="[^"].*\.(png|jpg|jpe?g|gif|tiff|svg|pdf|bmp)"' "${__downloader_tempfile}" |
sedx 's/^\s+//g; s/\s+$//g; s/.*src="?//g; s/".*$//g' |
grep -E "${flags}" |
sort |
Expand Down
2 changes: 1 addition & 1 deletion bin/install-direnv
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function direnv.register() {
inf "Ensuring direnv hook is registered..."

local C
local shell="${ZSH_NAME:-$(basename ${SHELL})}"
local shell="${ZSH_NAME:-$(basename "${SHELL}")}"

if [[ ${shell} == bash || ${shell} == zsh ]] ; then
C="${HOME}/.${shell}rc"
Expand Down
6 changes: 3 additions & 3 deletions bin/install-grc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function grc.install.extras() {
run "cp -rpnv ${BASHMATIC_HOME}/conf/grc/conf.* /usr/local/share/grc | sed 's/^/ ❯ /g' || true"
run "cp -rpv ${BASHMATIC_HOME}/conf/grc/.[a-z]* ${HOME} | sed 's/^/ ❯ /g' || true"

for file in "$(find ${BASHMATIC_HOME}/conf/grc -type f -maxdepth 1 -name 'conf.*' -print)"; do
for file in "$(find "${BASHMATIC_HOME}"/conf/grc -type f -maxdepth 1 -name 'conf.*' -print)"; do
command=$(basename "${file}" | sed 's/conf\.//')
if grep -q "colourify ${command}" "${shellrc}"; then
info "command ${command} is already aliased, skipping."
Expand All @@ -58,7 +58,7 @@ function grc.install.extras() {

function grc.install.core() {
# Setup Shell Integration
export SHELL_NAME=$(basename ${SHELL})
export SHELL_NAME=$(basename "${SHELL}")
export DEST="~/.grc.${SHELL_NAME}"
export SOURCE="grc.${SHELL}"
export INIT_PATH="/usr/local/etc"
Expand All @@ -73,7 +73,7 @@ function grc.install.core() {

local shellrc="${HOME}/.${SHELL_NAME}rc"
run "cd ~/ && ln -nfs ${INIT_PATH}/${SOURCE} ~/.${SOURCE}"
grep -q ${SOURCE} ${shellrc} || run "echo 'source ~/.${SOURCE}' >> ${shellrc}"
grep -q ${SOURCE} "${shellrc}" || run "echo 'source ~/.${SOURCE}' >> ${shellrc}"

grc.install.extras "${shellrc}"

Expand Down
6 changes: 3 additions & 3 deletions bin/mysql-ramdisk
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function main() {

[[ -d "${ramdiskPath}" ]] || {
info "Mounting ${ramdiskSizeMB}MB ramdisk..."
echo 'y' | osx.ramdisk.mount ${ramdiskSizeMB} >/dev/null
echo 'y' | osx.ramdisk.mount "${ramdiskSizeMB}" >/dev/null
}

[[ -d "${ramdiskPath}/mysql" && ${force} -eq 0 ]] || {
Expand All @@ -166,8 +166,8 @@ function main() {

# This returns the path component inside the archive preceeding mysql/
# So, eg, for Volume/ramdisk/mysql it will return /Volume/ramdisk
local stripPath=$(gtar tvzf ${mysqlBackup} --wildcards '*/ib_logfile1' | awk '{print $6}' | sed 's#mysql/.*$##g')
local stripComponents=$(echo ${stripPath} | sed 's/[^/]*//g' | tr -d '\n' | wc -c | tr -d ' ')
local stripPath=$(gtar tvzf "${mysqlBackup}" --wildcards '*/ib_logfile1' | awk '{print $6}' | sed 's#mysql/.*$##g')
local stripComponents=$(echo "${stripPath}" | sed 's/[^/]*//g' | tr -d '\n' | wc -c | tr -d ' ')
run.set-next show-output-on
run "gtar --strip-components=${stripComponents} -xzf ${mysqlBackup}"
}
Expand Down
4 changes: 2 additions & 2 deletions bin/pdf-reduce
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function pdf.do.shrink() {
fi

((finished)) && \
success "File ${infile} has been reduced in size, and is now $(file.size.mb ${outfile}) — a ${delta}%% reduction."
success "File ${infile} has been reduced in size, and is now $(file.size.mb "${outfile}") — a ${delta}%% reduction."

((finished)) || { error "Did not properly finish."; return 1; }
}
Expand All @@ -126,7 +126,7 @@ function pdf.do.check_smaller() {

# +pdf.do.usage
function pdf.do.usage() {
usage-box "$(basename $1) infile [outfile] [resolution-in-dpi] © Reduces PDF filesize by lossy recompressing with Ghostscript." \
usage-box "$(basename "$1") infile [outfile] [resolution-in-dpi] © Reduces PDF filesize by lossy recompressing with Ghostscript." \
"$(cursor.up 1)$(cursor.left 10) " "$(cursor.left 2)Not guaranteed to succeed, but usually works.$(cursor.right 26)" \
" " " " \
" " "$(cursor.left 17)${txtgrn}Copyright © 2014-2019, Alfred Klomp, All rights reserved.$(cursor.right 20)" \
Expand Down
4 changes: 2 additions & 2 deletions bin/puma-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ puma.pids.count() {
local extra_flag="${1}"
shift

printf "%d" "$(ps -ef | ${GrepCommand} '[p]uma[: ]' | ${GrepCommand} ${extra_flag} "${extra_filter}" | grep -v puma-ctl | wc -l | sed 's/\ //g')"
printf "%d" "$(ps -ef | ${GrepCommand} '[p]uma[: ]' | ${GrepCommand} "${extra_flag}" "${extra_filter}" | grep -v puma-ctl | wc -l | sed 's/\ //g')"
}

# STATE ——————————————————————————————————————————————————————————————————————
Expand Down Expand Up @@ -96,7 +96,7 @@ puma.status.listing() {
puma.status.tree() {
local mpid=$(puma.pids.master)
if [[ -n ${mpid} ]]; then
pstree -g 3 -p ${mpid}
pstree -g 3 -p "${mpid}"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion bin/regen-changelog
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ${bldylw}DESCRPTION:${clr}
Github tagging history.
${clr}
"
exit ${1:-1}
exit "${1:-1}"
}

export GITHUB_TOKEN="${GITHUB_TOKEN:-$(git config user.token)}"
Expand Down
4 changes: 2 additions & 2 deletions bin/regen-index-docs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ HEADER
printf "\n${txtylw}(${module}) ${bldgrn}"

printf "\n=== Module \`%s\`\n\n" "${module}" >>"${temp}"
for function in $(bashmatic.functions-from ${module} 1); do
for function in $(bashmatic.functions-from "${module}" 1); do
printf "•"
(
printf "==== \`%s\`\n" "${function}"
Expand Down Expand Up @@ -66,7 +66,7 @@ generate-shdoc() {

for file in $(find bin -name '[a-z]*' -type f); do
info "Extracting shdoc from ${bldylw}${file}..."
bin/shdoc ${file} >> ${usage}
bin/shdoc "${file}" >> ${usage}
done
hr ; echo
info "shdoc generated, converting USAGE.md to asciiidoc..."
Expand Down
4 changes: 2 additions & 2 deletions bin/scheck
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ function is.shellcheck-current() {
# @description Manually Download and Install ShellCheck
function manual-install() {
local temp="${TEMP_DIR}"
cd "${temp}" >/dev/null
cd "${temp}" >/dev/null || exit
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.${os}.x86_64.tar.xz" -O
is.a-command 7z || package.install p7zip
run "7z x *.xz"
run "7z x *.tar"
arrow.blk-on-ylw "PWD: ${PWD}"
cd "shellcheck-v0.7.1"
cd "shellcheck-v0.7.1" || exit

[[ -x /usr/local/bin/shellcheck ]] && run "rm -f /usr/local/bin/shellcheck || sudo rm -f /usr/local/bin/shellcheck || true"

Expand Down
18 changes: 9 additions & 9 deletions bin/upgrade-shell
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ bash.append_path() {
local file=${1}
local new_path=${2:-"/usr/local/bin"}
local string="export PATH=\"${new_path}:\${PATH}\""
if [[ -z $(${GrepCommand} "export PATH=\"${new_path}" ${file}) ]]; then
if [[ -z $(${GrepCommand} "export PATH=\"${new_path}" "${file}") ]]; then
echo "adding ${txtblue}${new_path}${clr} to ${txtgrn}${file}${clr}"
set -e
echo >>${file}
echo "${string}" >>${file}
echo >>${file}
echo >>"${file}"
echo "${string}" >>"${file}"
echo >>"${file}"
set +e
ok:
else
Expand All @@ -59,9 +59,9 @@ bash.install.path.rc() {

bash.current.shell() {
if [[ -n $(which finger) ]]; then
finger ${USER} | grep Shell | awk '{print $4}'
finger "${USER}" | grep Shell | awk '{print $4}'
else
echo $SHELL
echo "$SHELL"
fi
}

Expand All @@ -78,13 +78,13 @@ bash.user.chsh() {
fi

if [[ -x ${new_shell} ]]; then
if [[ -z $(grep ${new_shell} /etc/shells) ]]; then
if [[ -z $(grep "${new_shell}" /etc/shells) ]]; then
echo "Please enter your password if asked, as the following command may require sudo:"
echo ${new_shell} | sudo tee -a /etc/shells
echo "${new_shell}" | sudo tee -a /etc/shells
fi

set -ex
chsh -s ${new_shell}
chsh -s "${new_shell}"
set +ex
echo "Great, shell change was successful."
echo
Expand Down
Loading