Fixed #61 : SheerkaDebugManager: Add get_value()

Fixed #60 : Hash error when ReturnValue is a list of list
Fixed #59 : Implement smart_get()
Fixed #58 : SheerkaPromptCompleter: Cannot parse concept token
Fixed #57 : SheerkaPrompt: Add concept autocompletion
Fixed #56 : automatically backup command
Fixed #54 : I can record execution status
Fixed #53 : ConceptManager: modify_concept fails
This commit is contained in:
2021-04-09 15:47:32 +02:00
parent 6cda2686fb
commit dd3d8f4abe
37 changed files with 1055 additions and 191 deletions
+31 -13
View File
@@ -1,42 +1,60 @@
#!/bin/sh
#!/bin/bash
set -e
BASEDIR=$(dirname "$0")
list_available() {
available=$(ls "$BASEDIR"/../_concepts_*.txt | awk -F_ '{ print " "$3}' ) 2> /dev/null
available=$(find "$SHEERKA_BACKUP_FOLDER"/*.sb -type f -printf "%f\n" | sed 's/\.[^.]*$//') 2> /dev/null
if [ "$available" = "" ]; then
echo "Error. No available environment !" >&2
echo "Error. No available backup !" >&2
else
echo "Available environments are:"
echo "$available"
echo "Available backups are:"
for backup in ${available}; do
echo " ${backup}";
done
fi
}
if [ "$#" -eq 0 ]; then
echo "Usage: $0 <environment>"
usage() {
echo "Usage: $0 <backup>"
echo "Creates a fresh install of Sheerka, using the provided backup file."
list_available
exit 0
}
if [ "$#" -eq 0 ] || [ "$1" = "-h" ]; then
usage
fi
env_file="$BASEDIR"/../_concepts_"$1".txt
env_folder="$HOME/.sheerka_$1"
if ! [ -e "$env_file" ]; then
echo "$env_file not found" >&2
if [ -z "${SHEERKA_BACKUP_FOLDER+x}" ]; then
echo "SHEERKA_BACKUP_FOLDER is not set !"
exit 1
fi
backup_file="$SHEERKA_BACKUP_FOLDER"/"$1".sb
sheerka_root_folder="$HOME/.sheerka_$1"
if ! [ -e "$backup_file" ]; then
echo "$backup_file not found" >&2
list_available
exit 1
fi
echo "Rebuilding $1..."
# backup current sheerka
if [ -e ~/.sheerka ]; then
rm -rf ~/.sheerka.bak
mv ~/.sheerka ~/.sheerka.bak
fi
# re-install sheerka, using the requested backup file
python "$BASEDIR"/../main.py "sheerka.restore('$1')"
rm -rf "$env_folder"
cp -R ~/.sheerka "$env_folder"
# create a copy of the freshly installed sheerka, for future reset
rm -rf "$sheerka_root_folder"
cp -R ~/.sheerka "$sheerka_root_folder"