mirror of
https://gitlab.com/spectre.app/cli.git
synced 2024-11-01 02:41:44 +01:00
Make mpw_mkpw symlinkable.
This commit is contained in:
parent
e4ceafd0d2
commit
9785adbf0b
2 changed files with 38 additions and 6 deletions
|
@ -261,7 +261,10 @@ chr() {
|
|||
# Outputs the decimal ASCII value of the given character.
|
||||
#
|
||||
ord() {
|
||||
printf '%d' "'$1"
|
||||
local str=$1 s
|
||||
for (( s=0; s < ${#str}; ++s )); do
|
||||
printf '%d' "'${str:s:1}"
|
||||
done
|
||||
} # _____________________________________________________________________
|
||||
|
||||
|
||||
|
@ -274,7 +277,10 @@ ord() {
|
|||
# Outputs the hexadecimal ASCII value of the given character.
|
||||
#
|
||||
hex() {
|
||||
printf '%x' "'$1"
|
||||
local str=$1 s
|
||||
for (( s=0; s < ${#str}; ++s )); do
|
||||
printf '%02X' "'${str:s:1}"
|
||||
done
|
||||
} # _____________________________________________________________________
|
||||
|
||||
|
||||
|
@ -287,7 +293,10 @@ hex() {
|
|||
# Outputs the character that has the given hexadecimal ASCII value.
|
||||
#
|
||||
unhex() {
|
||||
printf "\\x$1"
|
||||
local hex=$1 h
|
||||
for (( h=0; h < ${#hex}; h+=2 )); do
|
||||
printf "\\x${hex:h:2}"
|
||||
done
|
||||
} # _____________________________________________________________________
|
||||
|
||||
|
||||
|
@ -1422,6 +1431,29 @@ shorten() {
|
|||
|
||||
|
||||
|
||||
# ______________________________________________________________________
|
||||
# |__ CdSource ________________________________________________________________|
|
||||
#
|
||||
# cdsource [file]
|
||||
#
|
||||
# Change the current directory into the directory where the file is located, resolving symlinks.
|
||||
#
|
||||
cdsource() {
|
||||
local source=${1:-${BASH_SOURCE[1]}}
|
||||
|
||||
while [[ $source ]]; do
|
||||
[[ $source = */* ]] && cd "${source%/*}"
|
||||
|
||||
if [[ -L ${source##*/} ]]; then
|
||||
source=$(readlink "${source##*/}")
|
||||
else
|
||||
source=
|
||||
fi
|
||||
done
|
||||
} # _____________________________________________________________________
|
||||
|
||||
|
||||
|
||||
# ______________________________________________________________________
|
||||
# |__ Up ________________________________________________________________|
|
||||
#
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
source bashlib
|
||||
cdsource
|
||||
|
||||
getword() {
|
||||
local cat=$1 pop_limit=$2 words=()
|
||||
|
@ -19,9 +21,7 @@ declare -A categoryByCharacter=(
|
|||
['v']=verb
|
||||
)
|
||||
templates=(
|
||||
nvan
|
||||
anvr
|
||||
anavan
|
||||
ran # ~32.0 bit
|
||||
)
|
||||
permutations=1
|
||||
|
||||
|
|
Loading…
Reference in a new issue