Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Nov 23, 2024
1 parent 35150e9 commit bd40894
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
10 changes: 8 additions & 2 deletions +matnwb/+extension/installExtension.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
function installExtension(extensionName)
% installExtension - Install NWB extension from Neurodata Extensions Catalog
%
% matnwb.extension.nwbInstallExtension(extensionNames) installs Neurodata
% Without Borders (NWB) extensions to extend the functionality of the core
% NWB schemas.

arguments
extensionName (1,1) string
end
Expand Down Expand Up @@ -55,12 +61,12 @@ function installExtension(extensionName)
assert(...
~isempty(L), ...
'NWB:InstallExtension:NamespaceNotFound', ...
'No namespace file was found for extension "%s"', extension.Identifier ...
'No namespace file was found for extension "%s"', extensionName ...
)
assert(...
numel(L)==1, ...
'NWB:InstallExtension:MultipleNamespacesFound', ...
'More than one namespace file was found for extension "%s"', extension.Identifier ...
'More than one namespace file was found for extension "%s"', extensionName ...
)
generateExtension( fullfile(L.folder, L.name) );
end
Expand Down
20 changes: 10 additions & 10 deletions nwbInstallExtension.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
function nwbInstallExtension(extensionName)
function nwbInstallExtension(extensionNames)
% nwbInstallExtension - Installs a specified NWB extension.
%
% nwbInstallExtension(extensionName) installs a Neurodata Without Borders
% (NWB) extension to extend the functionality of the core NWB schemas.
% extensionName is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extesions Catalog
%
% Usage:
% nwbInstallExtension(extensionName)
% nwbInstallExtension(extensionNames) installs Neurodata Without Borders
% (NWB) extensions to extend the functionality of the core NWB schemas.
% extensionNames is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extensions Catalog
%
% Valid Extension Names:
% - "ndx-miniscope"
Expand Down Expand Up @@ -42,7 +40,7 @@ function nwbInstallExtension(extensionName)
% matnwb.extension.listExtensions, matnwb.extension.installExtension

arguments
extensionName (1,:) string {mustBeMember(extensionName, [...
extensionNames (1,:) string {mustBeMember(extensionNames, [...
"ndx-miniscope", ...
"ndx-simulation-output", ...
"ndx-ecog", ...
Expand All @@ -69,11 +67,13 @@ function nwbInstallExtension(extensionName)
] ...
)} = []
end
if isempty(extensionName)
if isempty(extensionNames)
T = matnwb.extension.listExtensions();
extensionList = join( compose(" %s", [T.name]), newline );
error("Please specify the name of an extension. Available extensions:\n\n%s\n", extensionList)
else
matnwb.extension.installExtension(extensionName)
for extensionName = extensionNames
matnwb.extension.installExtension(extensionName)
end
end
end
20 changes: 10 additions & 10 deletions resources/function_templates/nwbInstallExtension.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
function nwbInstallExtension(extensionName)
function nwbInstallExtension(extensionNames)
% nwbInstallExtension - Installs a specified NWB extension.
%
% nwbInstallExtension(extensionName) installs a Neurodata Without Borders
% (NWB) extension to extend the functionality of the core NWB schemas.
% extensionName is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extesions Catalog
%
% Usage:
% nwbInstallExtension(extensionName)
% nwbInstallExtension(extensionNames) installs Neurodata Without Borders
% (NWB) extensions to extend the functionality of the core NWB schemas.
% extensionNames is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extensions Catalog
%
% Valid Extension Names:
{{extensionNamesDoc}}
Expand All @@ -20,16 +18,18 @@ function nwbInstallExtension(extensionName)
% matnwb.extension.listExtensions, matnwb.extension.installExtension

arguments
extensionName (1,:) string {mustBeMember(extensionName, [...
extensionNames (1,:) string {mustBeMember(extensionNames, [...
{{extensionNames}} ...
] ...
)} = []
end
if isempty(extensionName)
if isempty(extensionNames)
T = matnwb.extension.listExtensions();
extensionList = join( compose(" %s", [T.name]), newline );
error("Please specify the name of an extension. Available extensions:\n\n%s\n", extensionList)
else
matnwb.extension.installExtension(extensionName)
for extensionName = extensionNames
matnwb.extension.installExtension(extensionName)
end
end
end

0 comments on commit bd40894

Please sign in to comment.