Compare commits

..

No commits in common. "513d09f797a5767c19911bd192839d68b0b7f900" and "58a0ca7c16b5bcef1ae4f689cde2c6984259e159" have entirely different histories.

4 changed files with 16 additions and 58 deletions

12
sh/alias/gpg.sh Normal file
View file

@ -0,0 +1,12 @@
# turn gpg agent off
gak() { a__gpg_agent_kill "${@}"; }
a__gpg_agent_kill() {
gpgconf \
--kill "gpg-agent"
}
# bind gpg agent to current tty
gau() { a__gpg_agent_update "${@}"; }
a__gpg_agent_update() {
rwx_gpg_agent_update
}

View file

@ -1,14 +1,4 @@
# functions to handle gpg
# turn gpg agent off
#= gak
rwx_gpg_agent_kill() {
gpgconf \
--kill "gpg-agent"
}
# bind gpg agent to current tty # bind gpg agent to current tty
#= gau
rwx_gpg_agent_update() { rwx_gpg_agent_update() {
gpg-connect-agent \ gpg-connect-agent \
updatestartuptty \ updatestartuptty \

View file

@ -172,23 +172,17 @@ RWX_REGEX_CONSTANT="[_A-Z][_0-9A-Z]*"
RWX_REGEX_FUNCTION="[_A-Za-z][_0-9A-Za-z]*" RWX_REGEX_FUNCTION="[_A-Za-z][_0-9A-Za-z]*"
RWX_REGEX_SET="=.*" RWX_REGEX_SET="=.*"
RWX_REGEX_SPACES="[[:space:]]*" RWX_REGEX_SPACES="[[:space:]]*"
RWX_REGEX_VARIABLE="[_a-z][_0-9a-z]*"
RWX_REGEX_BEGIN="^" RWX_REGEX_BEGIN="^${RWX_REGEX_SPACES}"
RWX_REGEX_OPEN="\ RWX_REGEX_OPEN="\
${RWX_REGEX_SPACES}(${RWX_REGEX_SPACES})${RWX_REGEX_SPACES}{.*" ${RWX_REGEX_SPACES}(${RWX_REGEX_SPACES})${RWX_REGEX_SPACES}{.*"
RWX_REGEX_TARGET_CONSTANT="\ RWX_REGEX_TARGET_CONSTANT="\
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_CONSTANT}\\)${RWX_REGEX_SET}" ${RWX_REGEX_BEGIN}\\(${RWX_REGEX_CONSTANT}\\)${RWX_REGEX_SET}"
RWX_REGEX_TARGET_DOC="\ RWX_REGEX_TARGET_DOC="\
${RWX_REGEX_BEGIN}${RWX_REGEX_SPACES}# \\(.*\\)${RWX_REGEX_SPACES}\$" ${RWX_REGEX_BEGIN}# \\(.*\\)${RWX_REGEX_SPACES}\$"
RWX_REGEX_TARGET_FUNCTION="\ RWX_REGEX_TARGET_FUNCTION="\
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_FUNCTION}\\)${RWX_REGEX_OPEN}" ${RWX_REGEX_BEGIN}\\(${RWX_REGEX_FUNCTION}\\)${RWX_REGEX_OPEN}"
RWX_REGEX_TARGET_VARIABLE="\
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_VARIABLE}\\)${RWX_REGEX_SET}"
# cache for code variables
_rwx_code_variables=""
rwx_parse_code() { rwx_parse_code() {
# parse aliases # parse aliases
@ -203,8 +197,6 @@ EOF
RWX_CONSTANTS="$(rwx_parse_constants)" RWX_CONSTANTS="$(rwx_parse_constants)"
# parse functions # parse functions
RWX_FUNCTIONS="$(rwx_parse_functions)" RWX_FUNCTIONS="$(rwx_parse_functions)"
# parse variables
_rwx_code_variables="$(rwx_parse_variables)"
} }
rwx_parse_aliases() { rwx_parse_aliases() {
printf "%s" "${_rwx_code}" | printf "%s" "${_rwx_code}" |
@ -213,23 +205,18 @@ rwx_parse_aliases() {
--file "${RWX_AWK}" --file "${RWX_AWK}"
} }
rwx_parse_constants() { rwx_parse_constants() {
printf "%s" "${_rwx_code}" | printf "%s\n" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p" sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p"
} }
rwx_parse_functions() { rwx_parse_functions() {
printf "%s" "${_rwx_code}" | printf "%s\n" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p" sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
} }
rwx_parse_variables() {
printf "%s" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_VARIABLE}|\\1|p"
}
# ╭──────┬──────╮ # ╭──────┬──────╮
# │ main │ test │ # │ main │ test │
# ╰──────┴──────╯ # ╰──────┴──────╯
#= rt
rwx_test() { rwx_test() {
local item local item
# TODO CODE # TODO CODE

View file

@ -1,38 +1,7 @@
# self # self
# module # module
# show the cached code
#= rc
rwx_code() {
echo "${_rwx_code}"
}
# show the cached aliases
#= rca
rwx_code_aliases() {
echo "${RWX_ALIASES}"
}
# show the cached constants
#= rcc
rwx_code_constants() {
echo "${RWX_CONSTANTS}"
}
# show the cached functions
#= rcf
rwx_code_functions() {
echo "${RWX_FUNCTIONS}"
}
# show the cached variables
#= rcv
rwx_code_variables() {
echo "${_rwx_code_variables}"
}
# meta doc # meta doc
#= rd
rwx_doc() { rwx_doc() {
local name="${1}" local name="${1}"
[ -n "${name}" ] || return [ -n "${name}" ] || return