Skip to content

Commit 814d69b

Browse files
author
Alan Christie
committed
Adds 'list-environments'
1 parent 0edbf93 commit 814d69b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ You should find the following tools in this repository: -
4646
- `delete-all-instances`
4747
- `delete-old-instances`
4848
- `delete-test-projects`
49+
- `list-environments`
4950
- `load-er`
5051
- `save-er`
5152

tools/list-environments.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
"""Prints the available environments.
3+
"""
4+
import sys
5+
from typing import List
6+
7+
from squonk2.environment import Environment
8+
9+
environments: List[str] = Environment.load()
10+
if not environments:
11+
print("No environments found")
12+
sys.exit(1)
13+
14+
index: int = 1
15+
for environment in environments:
16+
if index == 1:
17+
print(f"{index}. {environment} (default)")
18+
first = False
19+
else:
20+
print(f"{index}. {environment}")
21+
index += 1

0 commit comments

Comments
 (0)