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
+5
View File
@@ -0,0 +1,5 @@
#compdef sheerka.rebuild.sh
_alternative \
'helps:helps:(-h)' \
'backups:available backups:($(find "$SHEERKA_BACKUP_FOLDER" -name "*.sb" -type f -printf "%f\n" | sed "s/\.[^.]*$//"))'
+5
View File
@@ -0,0 +1,5 @@
#compdef sheerka.reset.sh
_alternative \
'helps:helps:(-h)' \
"backups:available backups:($(find $HOME/.sheerka_* -maxdepth 0 -type d -printf '%f\n' | awk -F_ '{ print $2}'))"
+15
View File
@@ -0,0 +1,15 @@
To allow auto completion
* make sure the following lines are in the _.zshrc_ file
```bash
fpath=(~/my-completions $fpath)
autoload -Uz compinit
compinit
```
* create the folder _~/my-completions_
* copy the files __sheerka.rebuild_ and __sheerka.reset_ into the folder
* restart the shell
> :warning: **Environment variable SHEERKA_BACKUP_FOLDER must be set**
+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"
+30 -4
View File
@@ -1,5 +1,33 @@
#!/bin/sh
#!/bin/bash
list_available() {
available=$(find $HOME/.sheerka_* -maxdepth 0 -type d | awk -F_ '{ print " "$2}') 2> /dev/null
if [ "$available" = "" ]; then
echo "Error. No available environment !" >&2
else
echo "Available environment are:"
for backup in ${available}; do
echo " ${backup}";
done
fi
}
usage() {
echo "Usage: $0 [environment]"
echo "Resetting Sheerka environment from a previously build."
echo "If no environment is set, create a fresh install of Sheerka from scratch."
list_available
exit 0
}
if [ "$1" = "-h" ]; then
usage
fi
# No environment provided.
# Create a new environment from scratch (by simply removing .sheerka folder)
if [ "$#" -eq 0 ]; then
echo "Resetting Sheerka environment."
rm -rf ~/.sheerka
@@ -8,9 +36,7 @@ fi
if ! [ -e "$HOME/.sheerka_$1" ]; then
echo "$HOME/.sheerka_$1 not found" >&2
available=$(ls -d $HOME/.sheerka_* | awk -F_ '{ print " "$2}')
echo "Available environments are:"
echo "$available"
list_available
exit 1
fi