Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion synapse-api
23 changes: 23 additions & 0 deletions synapse/cli/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def add_commands(subparsers):
)
f.set_defaults(func=get_logs)

g = subparsers.add_parser("list-apps", help="List installed applications on the device")
g.set_defaults(func=list_apps)


def info(args):
device = syn.Device(args.uri, args.verbose)
Expand Down Expand Up @@ -338,3 +341,23 @@ def parse_datetime(time_str: Optional[str]) -> Optional[datetime]:
finally:
if output_file:
output_file.close()


def list_apps(args):
console = Console()
with console.status("Listing installed applications...", spinner="bouncingBall"):
device = syn.Device(args.uri, args.verbose)
response = device.list_apps()

if not response:
console.print("[bold red]Failed to list applications")
return

if not response.apps:
console.print("[yellow]No applications installed on the device")
return

console.print("[bold]Installed Applications:[/bold]")
for app in response.apps:
version_str = f" (v{app.version})" if app.version else ""
console.print(f" • {app.name}{version_str}")
13 changes: 13 additions & 0 deletions synapse/client/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
UpdateDeviceSettingsRequest,
UpdateDeviceSettingsResponse,
)
from synapse.api.app_pb2 import (
ListAppsRequest,
ListAppsResponse,
)
from synapse.client.config import Config
from synapse.utils.log import log_level_to_pb

Expand Down Expand Up @@ -197,6 +201,15 @@ def update_device_settings(
self.logger.error(f"Error during update settings: {str(e)}")
return None

def list_apps(self) -> Optional[ListAppsResponse]:
"""List installed applications on the device."""
try:
response = self.rpc.ListApps(ListAppsRequest())
return response
except grpc.RpcError as e:
self.logger.error("Error listing apps: %s", e.details())
return None

def _handle_status_response(self, status):
if status.code != StatusCode.kOk:
self.logger.error("Error %d: %s", status.code, status.message)
Expand Down