Merge pull request 'select-shell: show available names if provided name is incorrect' (#2060) from DavHau/clan-core:DavHau-dave into main
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user