Skip to content

Commit 97bf390

Browse files
committed
feat(profiles): profiles prefixed with an underscore (_) are now automatically hidden in profiles list command
1 parent 37fdbb3 commit 97bf390

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/robotcode/cli/commands/profiles.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ def show(app: Application, no_evaluate: bool, paths: List[Path]) -> None:
6767
nargs=-1,
6868
required=False,
6969
)
70+
@click.option("-h", "--show-hidden", is_flag=True, default=False, help="Show hidden profiles.")
7071
@pass_application
71-
def list(app: Application, paths: List[Path]) -> None:
72+
def list(app: Application, paths: List[Path], show_hidden: bool = False) -> None:
7273
"""Lists the defined profiles in the current configuration."""
7374

7475
try:
@@ -86,15 +87,19 @@ def check_enabled(name: str, profile: RobotProfile) -> bool:
8687
raise ValueError(f"Cannot evaluate profile '{name}'.enabled: {e}") from e
8788

8889
result: Dict[str, Any] = {
89-
"profiles": [
90-
{
91-
"name": k,
92-
"enabled": check_enabled(k, v),
93-
"description": v.description or "",
94-
"selected": True if k in selected_profiles else False,
95-
}
96-
for k, v in (config.profiles or {}).items()
97-
]
90+
"profiles": sorted(
91+
[
92+
{
93+
"name": k,
94+
"enabled": check_enabled(k, v),
95+
"description": v.description or "",
96+
"selected": True if k in selected_profiles else False,
97+
}
98+
for k, v in (config.profiles or {}).items()
99+
if show_hidden or not k.startswith("_")
100+
],
101+
key=lambda v: str(v.get("name", "")),
102+
)
98103
}
99104

100105
messages = []

0 commit comments

Comments
 (0)