@@ -136,7 +136,7 @@ def available_examples(self) -> dict[str, List[tuple[str, Path]]]:
136136 def copy_examples (
137137 self ,
138138 examples_to_copy : List [str ],
139- target_dir : Path = None ,
139+ target_dir : Union [ Path | str ] = None ,
140140 force : bool = False ,
141141 ) -> None :
142142 """Copy examples or packs into the target or current working
@@ -154,6 +154,8 @@ def copy_examples(
154154 overwritten and directories are merged
155155 (extra files in the target are preserved).
156156 """
157+ if isinstance (target_dir , str ):
158+ target_dir = Path (target_dir )
157159 self ._target_dir = target_dir .resolve () if target_dir else Path .cwd ()
158160 self ._force = force
159161
@@ -348,24 +350,48 @@ def install_pack(self, identifier: str | Path) -> None:
348350 else :
349351 plog .error ("Pack '%s' installation failed." , path .stem )
350352
351- def print_info (self ) -> None :
352- """Print information about available packs and examples."""
353- uninstalled_packs = []
354- installed_packs = []
353+ def print_packs (self ) -> None :
354+ """Print information about available packs."""
355+ uninstalled_packs , installed_packs = [], []
355356 for pack in self .available_packs ():
356357 if self .check_pack (pack ):
357358 installed_packs .append (pack )
358359 else :
359360 uninstalled_packs .append (pack )
360361 print ("Installed Packs:" )
362+ print ("----------------" )
361363 for pack in installed_packs :
362- print (f" { pack } " )
363- print ("\n Available Packs to Install:" )
364- for pack in uninstalled_packs :
365- print (f" { pack } " )
364+ if not installed_packs :
365+ print (" (none)" )
366+ else :
367+ print (f" { pack } " )
368+ print ("\n Available Packs:" )
369+ print ("----------------" )
370+ if not uninstalled_packs :
371+ print (" (all packs installed)" )
372+ else :
373+ for pack in uninstalled_packs :
374+ print (f" { pack } " )
375+
376+ def print_examples (self ) -> None :
377+ """Print information about available examples."""
366378 print ("\n Examples:" )
379+ print ("---------" )
367380 examples_dict = self .available_examples ()
368381 for pack , examples in examples_dict .items ():
369382 print (f" { pack } :" )
370383 for ex_name , _ in examples :
371384 print (f" - { ex_name } " )
385+
386+ def print_info (self ) -> None :
387+ """Print information about available packs, profiles, and
388+ examples."""
389+ # packs
390+ self .print_packs ()
391+ # profiles
392+ from diffpy .cmi .profilesmanager import ProfilesManager
393+
394+ prm = ProfilesManager ()
395+ prm .print_profiles ()
396+ # examples
397+ self .print_examples ()
0 commit comments