From 79321485c71548dd30b742b846c52e91f80e3d37 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 7 Jul 2025 15:47:14 +0200 Subject: [PATCH] docs/api: add docstrings to {list_mdns_services, set_clan_details} --- pkgs/clan-cli/clan_lib/api/mdns_discovery.py | 4 ++++ pkgs/clan-cli/clan_lib/clan/update.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/pkgs/clan-cli/clan_lib/api/mdns_discovery.py b/pkgs/clan-cli/clan_lib/api/mdns_discovery.py index 93c1bc2c4..dfbaacb30 100644 --- a/pkgs/clan-cli/clan_lib/api/mdns_discovery.py +++ b/pkgs/clan-cli/clan_lib/api/mdns_discovery.py @@ -89,6 +89,10 @@ def parse_avahi_output(output: str) -> DNSInfo: @API.register def list_mdns_services() -> DNSInfo: + """List mDNS/DNS-SD services on the local network. + Returns: + DNSInfo: A dictionary containing discovered mDNS/DNS-SD services. + """ cmd = nix_shell( ["avahi"], [ diff --git a/pkgs/clan-cli/clan_lib/clan/update.py b/pkgs/clan-cli/clan_lib/clan/update.py index 7e735ba4f..59c13147e 100644 --- a/pkgs/clan-cli/clan_lib/clan/update.py +++ b/pkgs/clan-cli/clan_lib/clan/update.py @@ -15,6 +15,14 @@ class UpdateOptions: @API.register def set_clan_details(options: UpdateOptions) -> InventorySnapshot: + """Update the clan metadata in the inventory of a given flake. + Args: + options: UpdateOptions containing the flake and the new metadata. + Returns: + InventorySnapshot: The updated inventory snapshot after modifying the metadata. + Raises: + ClanError: If the flake does not exist or if the inventory is invalid (missing the meta attribute). + """ inventory_store = InventoryStore(options.flake) inventory = inventory_store.read() set_value_by_path(inventory, "meta", options.meta)