ao-mud is a spellbook of well-commented atomic bash scripts that each do one thing. we are building semantic building blocks for an autonomously-evolving digital spellcasting language.
You can not select more than 25 topicsTopics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
# If no key name was given, check if there are at least two extended attributes
if [ $(echo "$keys" | wc -l) -lt 2 ]; then
# If there is only one extended attribute, delete it
key=$(echo "$keys")
disenchant_one "$key" "$1"
else
# If there are at least two extended attributes, provide a menu of the keys and select one with the arrow keys
keys="$keys disenchant-all"
times=$(($(echo "$keys" | wc -l) + 1))
desc="# disenchant this"
descriptions=()
for ((i = 1; i <= $times; i++)); do
descriptions+=("$desc")
done
echo "${descriptions[@]}"
menu "Choose which attribute to disenchant:" "$keys" $descriptions "menu_choice" # todo / problem: $descriptions needs to be a string but then it's only space-delimited so many commands cant work. solution is to refactor the menu script, splitting it up into many small and complete semantic scripts, and building a better more holistic and composed menu with lots of better building blocks. or using bmenu.
echo $menu_choice
key=${keys[$menu_choice]}
if [ -n "$key" ]; then
if [ "$key" = "disenchant all" ]; then
# Disenchant all extended attributes
for key in $keys; do
disenchant_one "$key" "$1"
done
echo "Disenchanted all attributes from $1."
break
else
# Disenchant the selected attribute
echo KEY $key
echo FILE $1
disenchant_one "$key" "$1"
break
fi
else
# If no key was selected, print an error message and exit