start-gui.sh et améliorations diverses
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# With no arguments, choose the newest visible immediate subfolder by mtime.
|
||||
if [[ $# -eq 0 ]]; then
|
||||
newest=""
|
||||
for candidate in "$PWD"/*/; do
|
||||
[[ -d "$candidate" ]] || continue
|
||||
folder="${candidate%/}"
|
||||
folder="${folder##*/}"
|
||||
case "$folder" in
|
||||
copienator|copienator_gui|tests|OLD|__pycache__|build|dist|*.egg-info|venv|env|node_modules)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [[ -z "$newest" || "$candidate" -nt "$newest" ]]; then
|
||||
newest="$candidate"
|
||||
fi
|
||||
done
|
||||
if [[ -n "$newest" ]]; then
|
||||
set -- "${newest%/}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Resolve the evaluation before changing to the project directory.
|
||||
if [[ $# -gt 0 && "$1" != -* && "$1" != /* ]]; then
|
||||
evaluation="$PWD/$1"
|
||||
shift
|
||||
set -- "$evaluation" "$@"
|
||||
fi
|
||||
repository="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd -- "$repository"
|
||||
|
||||
if [[ -x "$repository/.venv/bin/python" ]]; then
|
||||
python_command="$repository/.venv/bin/python"
|
||||
else
|
||||
python_command="python3"
|
||||
fi
|
||||
exec "$python_command" -m copienator_gui "$@"
|
||||
Reference in New Issue
Block a user