Add --quiet option to gui-uv.sh

pull/3263/head
bmaltais 2025-05-26 18:14:58 -04:00
parent ac12faa5f7
commit 0524896383
1 changed files with 12 additions and 14 deletions

View File

@ -1,8 +1,6 @@
#!/usr/bin/env bash
export VIRTUAL_ENV=.venv
# Checks to see if variable is set and non-empty.
# This is defined first, so we can use the function for some default variable values
env_var_exists() {
if [[ -n "${!1}" ]]; then
return 0
@ -11,33 +9,33 @@ env_var_exists() {
fi
}
# Define the directory path for WSL2
lib_path="/usr/lib/wsl/lib/"
# Check if the directory exists
if [ -d "$lib_path" ]; then
# Check if LD_LIBRARY_PATH is already set
if [ -z "${LD_LIBRARY_PATH}" ]; then
# LD_LIBRARY_PATH is not set, set it to the lib_path
export LD_LIBRARY_PATH="$lib_path"
# echo "LD_LIBRARY_PATH set to: $LD_LIBRARY_PATH"
fi
fi
# If it is run with the sudo command, get the complete LD_LIBRARY_PATH environment variable of the system and assign it to the current environment,
# because it will be used later.
if [ -n "$SUDO_USER" ] || [ -n "$SUDO_COMMAND" ]; then
echo "The sudo command resets the non-essential environment variables, we keep the LD_LIBRARY_PATH variable."
export LD_LIBRARY_PATH=$(sudo -i printenv LD_LIBRARY_PATH)
fi
# This gets the directory the script is run from so pathing can work relative to the script where needed.
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# Step into GUI local directory
cd "$SCRIPT_DIR" || exit 1
# Check if uv is already installed
# Check if --quiet is in the arguments
uv_quiet=""
args=()
for arg in "$@"; do
if [[ "$arg" == "--quiet" ]]; then
uv_quiet="--quiet"
else
args+=("$arg")
fi
done
if ! command -v uv &> /dev/null; then
read -p "uv is not installed. We can try to install it for you, or you can install it manually from https://astral.sh/uv before running this script again. Would you like to attempt automatic installation now? [Y/n]: " install_uv
if [[ "$install_uv" =~ ^[Yy]$ ]]; then
@ -50,4 +48,4 @@ if ! command -v uv &> /dev/null; then
fi
git submodule update --init --recursive
uv run kohya_gui.py --noverify "$@"
uv run $uv_quiet kohya_gui.py --noverify "${args[@]}"