63 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Function to install docgen
install_docgen() {
echo "Creating virtual environment..."
python3 -m venv docgen
source docgen/bin/activate
echo "Installing openscad_docsgen..."
pip install openscad_docsgen
echo "Installation completed."
}
# Function to run openscad-docsgen with your specified options
run_docsgen() {
# Check if we are in the virtual environment
if [ -z "$VIRTUAL_ENV" ] || [ ! "$(basename "$VIRTUAL_ENV")" == "docgen" ]; then
echo "Activating docgen virtual environment..."
source docgen/bin/activate || { echo "Failed to activate virtual environment. Make sure 'docgen' exists."; return 1; }
fi
echo "Running openscad-docsgen..."
#openscad-docsgen -m -I -P "Metalib" -f -p wiki -i -t -m -s
openscad-docsgen -f
echo "Documentation generation completed."
}
# Function to uninstall (deactivate the virtual environment)
uninstall_docgen() {
echo "Deactivating virtual environment..."
deactivate
echo "Virtual environment deactivated."
}
# Main script logic
echo "OpenSCAD DocsGen Script"
echo "----------------------"
echo "1. Doc Generation"
echo "2. Install docgen"
echo "3. Uninstall docgen"
echo "q. Exit"
while true; do
read -p "Choose an option (1/2/3/q): " choice
case $choice in
1)
run_docsgen
;;
2)
install_docgen
;;
3)
uninstall_docgen
;;
q)
echo "Exiting script. Goodbye!"
exit 0
;;
*)
echo "Invalid option. Please try again."
;;
esac
done