From b9f8f2cedd96a65c2be314a2756b22cea8bed099 Mon Sep 17 00:00:00 2001 From: ehennestad Date: Tue, 14 Jan 2025 19:13:43 +0100 Subject: [PATCH] Add docstrings for functions to retrieve and list extension info --- +matnwb/+extension/getExtensionInfo.m | 38 ++++++++++++++++++++++++--- +matnwb/+extension/listExtensions.m | 22 ++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/+matnwb/+extension/getExtensionInfo.m b/+matnwb/+extension/getExtensionInfo.m index 411978b0..85b4b3c8 100644 --- a/+matnwb/+extension/getExtensionInfo.m +++ b/+matnwb/+extension/getExtensionInfo.m @@ -1,5 +1,37 @@ -function metadata = getExtensionInfo(extensionName) -% getExtensionInfo - Get metadata for specified extension +function info = getExtensionInfo(extensionName) +% getExtensionInfo - Get metadata for the specified Neurodata extension +% +% Syntax: +% info = matnwb.extension.GETEXTENSIONINFO(extensionName) Returns a struct +% with metadata/information about the specified extension. The extension +% must be registered in the Neurodata Extension Catalog. +% +% Input Arguments: +% - extensionName (string) - +% Name of a Neurodata Extension, e.g "ndx-miniscope". +% +% Output Arguments: +% - info (struct) - +% Struct with metadata / information for the specified extension. The struct +% has the following fields +% - name : The name of the extension. +% - version : The current version of the extension. +% - last_updated : A timestamp indicating when the extension was last updated. +% - src : The URL to the source repository or homepage of the extension. +% - license : The license type under which the extension is distributed. +% - maintainers : A cell array or array of strings listing the maintainers. +% - readme : A string containing the README documentation or description. +% +% Usage: +% Example 1 - Retrieve and display information for the 'ndx-miniscope' extension:: +% +% info = matnwb.extension.getExtensionInfo('ndx-miniscope'); +% +% % Display the version of the extension. +% fprintf('Extension version: %s\n', info.version); +% +% See also: +% matnwb.extension.listExtensions arguments extensionName (1,1) string @@ -12,5 +44,5 @@ any(isMatch), ... 'NWB:DisplayExtensionMetadata:ExtensionNotFound', ... 'Extension "%s" was not found in the extension catalog:\n%s', extensionName, extensionList) - metadata = table2struct(T(isMatch, :)); + info = table2struct(T(isMatch, :)); end diff --git a/+matnwb/+extension/listExtensions.m b/+matnwb/+extension/listExtensions.m index e8ae59c1..56821dcb 100644 --- a/+matnwb/+extension/listExtensions.m +++ b/+matnwb/+extension/listExtensions.m @@ -1,5 +1,27 @@ function extensionTable = listExtensions(options) +% listExtensions - List available extensions in the Neurodata Extension Catalog +% +% Syntax: +% extensionTable = matnwb.extension.listExtensions() returns a table where +% each row holds information about a registered extension. +% +% Output Arguments: +% - extensionTable (table) - +% Table of metadata / information for each registered extension. The table +% has the following columns +% - name : The name of the extension. +% - version : The current version of the extension. +% - last_updated : A timestamp indicating when the extension was last updated. +% - src : The URL to the source repository or homepage of the extension. +% - license : The license type under which the extension is distributed. +% - maintainers : A cell array or array of strings listing the maintainers. +% - readme : A string containing the README documentation or description. +% +% See also: matnwb.extension.getExtensionInfo + arguments + % Refresh - Flag to refresh the catalog (Only relevant if the + % remote catalog has been updated). options.Refresh (1,1) logical = false end