interceptor

package
v0.0.0-...-4efc8f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultOptionPromptPattern  默认选项的匹配规则
	DefaultOptionPromptPattern = `(?i)[\[(]y(es)?[/|]no?[\])][?:]\s*$`
	// FlexibleOptionPromptPattern 灵活选项的匹配规则
	FlexibleOptionPromptPattern = `(?i)[\[(][a-z]+([/|][a-z\[\]]+)+[\])][?:]\s*$`
)

Variables

This section is empty.

Functions

func AppendLF

func AppendLF(s string) string

func LastLine

func LastLine(str string) string

Types

type Interceptor

type Interceptor func(str string) (match bool, showOut bool, input string)

func AlwaysNo

func AlwaysNo(showOut ...bool) Interceptor

func AlwaysOption

func AlwaysOption(optionIndex int, showOut ...bool) Interceptor

func AlwaysYes

func AlwaysYes(showOut ...bool) Interceptor

func Continue

func Continue() Interceptor

func LastLinePassword

func LastLinePassword(pattern string, input string, showOut ...bool) Interceptor

LastLinePassword 需要调用方保证 pattern 是合法的正则表达式

func LastLinePattern

func LastLinePattern(pattern string, input string, showOut ...bool) Interceptor

LastLinePattern 需要调用方保证 pattern 是合法的正则表达式

func LastLineRegex

func LastLineRegex(regex *regexp.Regexp, input string, showOut ...bool) Interceptor

func More

func More() Interceptor

func Password

func Password(pattern string, password string, showOut ...bool) Interceptor

Password 需要调用方保证 pattern 是合法的正则表达式

func Pattern

func Pattern(pattern string, input string, format func(string) string, showOut ...bool) Interceptor

Pattern 需要调用方保证 pattern 是合法的正则表达式

func Regexp

func Regexp(regex *regexp.Regexp, input string, format func(string) string, showOut ...bool) Interceptor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL