File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# Define variables
4- PROTOC=" python -m grpc_tools.protoc"
4+ PROTOC=" python3 -m grpc_tools.protoc"
55PROTO_DIR_SYNAPSE_API=" ./synapse-api"
66PROTO_OUT_SYNAPSE_API=" ./synapse"
77
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ def add_commands(subparsers):
9797 )
9898 f .set_defaults (func = get_logs )
9999
100+ g = subparsers .add_parser ("list-apps" , help = "List installed applications on the device" )
101+ g .set_defaults (func = list_apps )
102+
100103
101104def info (args ):
102105 device = syn .Device (args .uri , args .verbose )
@@ -338,3 +341,23 @@ def parse_datetime(time_str: Optional[str]) -> Optional[datetime]:
338341 finally :
339342 if output_file :
340343 output_file .close ()
344+
345+
346+ def list_apps (args ):
347+ console = Console ()
348+ with console .status ("Listing installed applications..." , spinner = "bouncingBall" ):
349+ device = syn .Device (args .uri , args .verbose )
350+ response = device .list_apps ()
351+
352+ if not response :
353+ console .print ("[bold red]Failed to list applications" )
354+ return
355+
356+ if not response .apps :
357+ console .print ("[yellow]No applications installed on the device" )
358+ return
359+
360+ console .print ("[bold]Installed Applications:[/bold]" )
361+ for app in response .apps :
362+ version_str = f" (v{ app .version } )" if app .version else ""
363+ console .print (f" • { app .name } { version_str } " )
Original file line number Diff line number Diff line change 1818 UpdateDeviceSettingsRequest ,
1919 UpdateDeviceSettingsResponse ,
2020)
21+ from synapse .api .app_pb2 import (
22+ ListAppsRequest ,
23+ ListAppsResponse ,
24+ )
2125from synapse .client .config import Config
2226from synapse .utils .log import log_level_to_pb
2327
@@ -197,6 +201,15 @@ def update_device_settings(
197201 self .logger .error (f"Error during update settings: { str (e )} " )
198202 return None
199203
204+ def list_apps (self ) -> Optional [ListAppsResponse ]:
205+ """List installed applications on the device."""
206+ try :
207+ response = self .rpc .ListApps (ListAppsRequest ())
208+ return response
209+ except grpc .RpcError as e :
210+ self .logger .error ("Error listing apps: %s" , e .details ())
211+ return None
212+
200213 def _handle_status_response (self , status ):
201214 if status .code != StatusCode .kOk :
202215 self .logger .error ("Error %d: %s" , status .code , status .message )
You can’t perform that action at this time.
0 commit comments