pkg

package
v0.0.0-...-11a6ff2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyWords    = []string{}
	Insensitive = false
)
View Source
var Filter = &cobra.Command{
	Use:   "filter",
	Short: "filters data from input using keywords",
	Long:  "filters out lines that contains any of the given keyword.Note filter does not support clipboard input",
	RunE: func(cmd *cobra.Command, args []string) error {
		scanner := asynchronousInput()
		if scanner == nil {
			log.Fatal("no input provided")
		}
		data := internal.ReadFromFile(wordFile)
		KeyWords = append(KeyWords, strings.Split(data, "\n")...)
		if len(KeyWords) == 0 {
			log.Fatal("filter keywords not provided")
		}

		for scanner.Scan() {
			line := scanner.Text()
			if !FilterLine(line) {
				fmt.Println(line)
			}
		}
		return nil
	},
}

Functions

func Execute

func Execute()

func FilterLine

func FilterLine(line string) bool

FilterLine Uses line

func InterpretString

func InterpretString(raw string) string

Converts a raw string to interpreted string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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