Enum ::patch::Action

Action to perform on a line when matched by a Selector

Variants

Copy the current line to the output. Only needed when auto-print is disabled.

Delete the current line and short circuit the rest of the program (immediately go to the next line)

Replace pattern space with next line (will print unless auto-print is disabled)

Stop processing the input and program and terminate early (do not print rest of file)

Stop processing the input and program and terminate early (auto-print rest of file)

Insert a new line before the current line

Insert a new line after the current line

Replace the entire current string with the given string

Do a regex search and replace in the current line.

Only the first match is replaced in any given line.

Capture groups in the replacement string works as with ::regex::Regex.

Like RegexReplace but replaces all matches on the line.

A sub-program that is executed. Will share pattern space with parent program

A custom function passed the current pattern buffer, returning a new pattern buffer

Methods

Create an action for a nested sub-program

Protocols

protocol is_variant

Test if the provided argument is a variant.

protocol get
let output = value.0

Allows a get operation to work.

protocol get
let output = value.1

Allows a get operation to work.