Files
Sheerka-Old/utils/sheerka.reset.sh
T
kodjo dd3d8f4abe 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
2021-04-09 15:47:32 +02:00

46 lines
1.0 KiB
Bash
Executable File

#!/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
exit 0
fi
if ! [ -e "$HOME/.sheerka_$1" ]; then
echo "$HOME/.sheerka_$1 not found" >&2
list_available
exit 1
fi
echo "Resetting Sheerka environment to '$1'."
rm -rf ~/.sheerka
cp -r "$HOME/.sheerka_$1" ~/.sheerka