@@ -273,3 +273,51 @@ def get(self, storage, name):
273273 raise RuntimeError ("Couldn't find %s" , name )
274274
275275 return result
276+
277+
278+ class OPSStorageLoadMultiple (OPSStorageLoadSingle ):
279+ """Objects that can guess a single object or have multiple specified.
280+
281+ Parameters
282+ ----------
283+ param : :class:`.AbstractParameter`
284+ the Option or Argument wrapping a click decorator
285+ store : Str
286+ the name of the store to search
287+ value_strategies : List[Callable[(:class:`.Storage`, Str), Any]]
288+ The strategies to be used when the CLI provides a value for this
289+ parameter. Each should be a callable taking a storage and the string
290+ input from the CLI, and should return the desired object or None if
291+ it cannot be found.
292+ none_strategies : List[Callable[:class:`openpathsampling.Storage, Any]]
293+ The strategies to be used when the CLI does not provide a value for
294+ this parameter. Each should be a callable taking a storage, and
295+ returning the desired object or None if it cannot be found.
296+ """
297+ def get (self , storage , names ):
298+ """Load desired objects from storage.
299+
300+ Parameters
301+ ----------
302+ storage : openpathsampling.Storage
303+ the input storage to search
304+ names : List[Str] or None
305+ strings from CLI providing the identifier (name or index) for
306+ this object; None if not provided
307+ """
308+ if names == tuple ():
309+ names = None
310+
311+ if names is None or isinstance (names , (str , int )):
312+ listified = True
313+ names = [names ]
314+ else :
315+ listified = False
316+
317+ results = [super (OPSStorageLoadMultiple , self ).get (storage , name )
318+ for name in names ]
319+
320+ if listified :
321+ results = results [0 ]
322+
323+ return results
0 commit comments