Skip to content

l0.DependencyControl.ScriptTargetFilter

ScriptTargetFilter = require "l0.DependencyControl.ScriptTargetFilter"
local ScriptTargetFilter = require("l0.DependencyControl.ScriptTargetFilter")

ScriptTargetFilter

Selects which packages a feed operation should process, by script type and namespace. Construct it from a spec table, or empty and build it up fluently — every builder method returns self so calls can be chained. Because modules and automation scripts aren't required to have unique namespaces, rules are keyed by script type first.

ScriptTargetFilter!\include(domain.ScriptType.Module, "l0.DependencyControl")
ScriptTargetFilter!\includeAll domain.ScriptType.Module   -- every module
ScriptTargetFilter!\includeAll!                            -- everything
ScriptTargetFilter {[domain.ScriptType.Module]: {include: {"l0.DependencyControl"}}}

Constructor

scriptTargetFilter = ScriptTargetFilter spec
local scriptTargetFilter = ScriptTargetFilter(spec)
param type description
spec? table<ScriptType, true | { include?: string[], exclude?: string[] }> Initial rules keyed by script type.

Instance methods

include

scriptTargetFilter\include scriptType, namespace
scriptTargetFilter:include(scriptType, namespace)

Includes a single namespace of the given script type.

param type description
scriptType ScriptType
namespace string

Returns:

includeAll

scriptTargetFilter\includeAll scriptType
scriptTargetFilter:includeAll(scriptType)

Includes every namespace of the given script type, or — when called without an argument — every namespace of every script type.

param type description
scriptType? ScriptType Script type to include all of; omit to include everything.

Returns:

exclude

scriptTargetFilter\exclude scriptType, namespace
scriptTargetFilter:exclude(scriptType, namespace)

Excludes a single namespace of the given script type (takes precedence over includes).

param type description
scriptType ScriptType
namespace string

Returns:

matches

scriptTargetFilter\matches scriptType, namespace
scriptTargetFilter:matches(scriptType, namespace)

Tests whether a script of the given type and namespace should be processed.

param type description
scriptType ScriptType
namespace string

Returns:

  • boolean

Fields

field type description
scriptTypes ScriptType[] The script types this filter would process (those carrying any rule), sorted. Read-only.
scriptTypeList ScriptType[]