Skip to contents

Look up a component in one or more repos. Unlike get_component(), returns NULL instead of raising an error when no repo contains the component. Each repo directory must exist, otherwise an error is raised.

Usage

find_component(component, repos = NULL)

Arguments

component

character component name, or path to a component file (.R or .mustache) when repos is NULL. The directory of the path must exist.

repos

Where to look. One of:

  • NULL (default): component is a file path.

  • character vector of repo specs, in priority order. See mighty_repo().

  • A mighty_repo_class object.

  • A list of repo specs or mighty_repo_class objects, in priority order.

  • A mighty_repos() collection.

Character vectors and lists are converted with mighty_repos(). GitHub refs are resolved once per session. See mighty_repo_github().

Value

A mighty_component object, or NULL if no repo contains the component.

Examples

path <- system.file("examples", package = "mighty.component")
find_component("ady", repos = path)
#> → Found "ady" in "local::/home/runner/work/_temp/Library/mighty.component/examples"
#> <mighty_component/R6>
#> ady.mustache: Analysis relative day
#> Type: column
#> Parameters:
#> • domain: `character` Name of new domain being created
#> • variable: `character` Name of new variable to create
#> • date: `character` Name of date variable to use
#> Depends:
#> • {{{domain}}}.{{{date}}}
#> • {{{domain}}}.TRTSDT
#> Outputs:
#> • {{{variable}}}

find_component("does_not_exist", repos = path)