@@ -1946,6 +1946,24 @@ def _component_display_name(
19461946 return name .replace ("_" , " " )
19471947
19481948
1949+ def _active_status (
1950+ is_active : bool , output_format : OutputFormat
1951+ ) -> Union [str , bool ]:
1952+ """Format active status based on output format.
1953+
1954+ Args:
1955+ is_active: Whether the item is active.
1956+ output_format: The output format.
1957+
1958+ Returns:
1959+ For table format: green dot if active, empty string if not.
1960+ For other formats: boolean value.
1961+ """
1962+ if output_format == "table" :
1963+ return "[green]●[/green]" if is_active else ""
1964+ return is_active
1965+
1966+
19491967def get_execution_status_emoji (status : "ExecutionStatus" ) -> str :
19501968 """Returns an emoji representing the given execution status.
19511969
@@ -2148,14 +2166,15 @@ def generate_stack_row(
21482166 is_active = active_id is not None and stack .id == active_id
21492167
21502168 row : Dict [str , Any ] = {
2151- "active" : "[green]●[/green]"
2152- if is_active and output_format == "table"
2153- else ("Yes" if is_active else "" ),
2169+ "active" : _active_status (is_active , output_format ),
21542170 }
21552171
21562172 for component_type in StackComponentType :
21572173 components = stack .components .get (component_type )
2158- header = component_type .value .upper ().replace ("_" , " " )
2174+ if output_format == "table" :
2175+ header = component_type .value .upper ().replace ("_" , " " )
2176+ else :
2177+ header = component_type .value
21592178 row [header ] = components [0 ].name if components else "-"
21602179
21612180 return row
@@ -2179,9 +2198,7 @@ def generate_project_row(
21792198 is_active = active_id is not None and project .id == active_id
21802199
21812200 return {
2182- "active" : "[green]●[/green]"
2183- if is_active and output_format == "table"
2184- else ("Yes" if is_active else "" ),
2201+ "active" : _active_status (is_active , output_format ),
21852202 }
21862203
21872204
@@ -2203,9 +2220,7 @@ def generate_user_row(
22032220 is_active = active_id is not None and user .id == active_id
22042221
22052222 return {
2206- "active" : "[green]●[/green]"
2207- if is_active and output_format == "table"
2208- else ("Yes" if is_active else "" ),
2223+ "active" : _active_status (is_active , output_format ),
22092224 }
22102225
22112226
@@ -2257,9 +2272,7 @@ def generate_component_row(
22572272 is_active = active_id is not None and component .id == active_id
22582273
22592274 return {
2260- "active" : "[green]●[/green]"
2261- if is_active and output_format == "table"
2262- else ("Yes" if is_active else "" ),
2275+ "active" : _active_status (is_active , output_format ),
22632276 "name" : component .name ,
22642277 "component_id" : component .id ,
22652278 "flavor" : component .flavor_name ,
@@ -2282,15 +2295,15 @@ def generate_connector_row(
22822295 Returns:
22832296 Dict with connector data for display.
22842297 """
2285- is_active = active_connector_ids and connector .id in active_connector_ids
2298+ is_active = bool (
2299+ active_connector_ids and connector .id in active_connector_ids
2300+ )
22862301 labels = [f"{ label } :{ value } " for label , value in connector .labels .items ()]
22872302 resource_name = connector .resource_id or "<multiple>"
22882303 resource_types_str = "\n " .join (connector .emojified_resource_types )
22892304
22902305 return {
2291- "active" : "[green]●[/green]"
2292- if is_active and output_format == "table"
2293- else ("Yes" if is_active else "" ),
2306+ "active" : _active_status (is_active , output_format ),
22942307 "name" : connector .name ,
22952308 "id" : connector .id ,
22962309 "type" : connector .emojified_connector_type ,
@@ -2868,8 +2881,11 @@ def is_sorted_or_filtered(ctx: click.Context) -> bool:
28682881 Returns:
28692882 True if any parameter source differs from default, else False.
28702883 """
2884+ display_options = {"output_format" , "columns" }
28712885 try :
2872- for _ , source in ctx ._parameter_source .items ():
2886+ for param , source in ctx ._parameter_source .items ():
2887+ if param in display_options :
2888+ continue
28732889 if source != click .core .ParameterSource .DEFAULT :
28742890 return True
28752891 return False
0 commit comments