@@ -67,8 +67,9 @@ def show(app: Application, no_evaluate: bool, paths: List[Path]) -> None:
67
67
nargs = - 1 ,
68
68
required = False ,
69
69
)
70
+ @click .option ("-h" , "--show-hidden" , is_flag = True , default = False , help = "Show hidden profiles." )
70
71
@pass_application
71
- def list (app : Application , paths : List [Path ]) -> None :
72
+ def list (app : Application , paths : List [Path ], show_hidden : bool = False ) -> None :
72
73
"""Lists the defined profiles in the current configuration."""
73
74
74
75
try :
@@ -86,15 +87,19 @@ def check_enabled(name: str, profile: RobotProfile) -> bool:
86
87
raise ValueError (f"Cannot evaluate profile '{ name } '.enabled: { e } " ) from e
87
88
88
89
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
+ )
98
103
}
99
104
100
105
messages = []
0 commit comments