MCPcopy Index your code
hub / github.com/pyinvoke/invoke / parse_collection

Method parse_collection

invoke/program.py:454–488  ·  view source on GitHub ↗

Load a tasks collection & project-level config. .. versionadded:: 1.0

(self)

Source from the content-addressed store, hash-verified

452 raise Exit
453
454 def parse_collection(self) -> None:
455 """
456 Load a tasks collection & project-level config.
457
458 .. versionadded:: 1.0
459 """
460 # Load a collection of tasks unless one was already set.
461 if self.namespace is not None:
462 debug(
463 "Program was given default namespace, not loading collection"
464 )
465 self.collection = self.namespace
466 else:
467 debug(
468 "No default namespace provided, trying to load one from disk"
469 ) # noqa
470 # If no bundled namespace & --help was given, just print it and
471 # exit. (If we did have a bundled namespace, core --help will be
472 # handled *after* the collection is loaded & parsing is done.)
473 if self.args.help.value is True:
474 debug(
475 "No bundled namespace & bare --help given; printing help."
476 )
477 self.print_help()
478 raise Exit
479 self.load_collection()
480 # Set these up for potential use later when listing tasks
481 # TODO: be nice if these came from the config...! Users would love to
482 # say they default to nested for example. Easy 2.x feature-add.
483 self.list_root: Optional[str] = None
484 self.list_depth: Optional[int] = None
485 self.list_format = "flat"
486 self.scoped_collection = self.collection
487
488 # TODO: load project conf, if possible, gracefully
489
490 def parse_cleanup(self) -> None:
491 """

Callers 1

runMethod · 0.95

Calls 2

print_helpMethod · 0.95
load_collectionMethod · 0.95

Tested by

no test coverage detected