diff --git a/pkgs/scripts/select-shell.py b/pkgs/scripts/select-shell.py index c4e25b915..4360d680b 100644 --- a/pkgs/scripts/select-shell.py +++ b/pkgs/scripts/select-shell.py @@ -32,7 +32,7 @@ def print_current_shell() -> None: print("No devshell selected") -def print_devshells() -> None: +def list_devshells() -> list[str]: project_root = os.environ.get("PRJ_ROOT") flake_show = subprocess.run( [ @@ -47,7 +47,12 @@ def print_devshells() -> None: stdout=subprocess.PIPE, ) names = json.loads(flake_show.stdout.decode()) - print("Available devshells:\n") + return names + + +def print_devshells() -> None: + names = list_devshells() + print("Available devshells:") print("\n".join(names)) @@ -55,6 +60,9 @@ def select_shell(shell: str) -> None: if shell == get_current_shell(): print(f"{shell} devshell already selected. No changes made.") sys.exit(0) + elif shell not in (names := list_devshells()): + print(f"devshell '{shell}' not found. Available devshells:") + print("\n".join(names)) else: with selected_shell_file.open("w") as f: f.write(shell) diff --git a/pkgs/tea-create-pr/script.sh b/pkgs/tea-create-pr/script.sh index 5399977a6..97ee9c7af 100755 --- a/pkgs/tea-create-pr/script.sh +++ b/pkgs/tea-create-pr/script.sh @@ -29,7 +29,15 @@ if ! check_remote "$remoteUpstream"; then exit 1 fi -treefmt --fail-on-change --no-cache + +# run formatting on a clean working tree +echo "stashing uncommitted changes to run treefmt" +git stash push +if ! treefmt --fail-on-change --no-cache; then + git stash pop + exit 1 +fi +git stash pop upstream_url=$(git remote get-url "$remoteUpstream") set -x