search

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 6 Imported by: 0

README

Go Go Report Card GitHub go.mod Go version GitHub

import github.com/qba73/search

Search is a small utility package for searching input for a given sub-string.

How to use it?

The search uses standard input and output as default settings (stdin, stdout).

Search("hello")

Use functionl options to change default settings and use different sources and destinations.

s := search.New(
    WithInput(io.Reader),
    WithOutput(io.Writer),
)

s.Search("hello")

Documentation

Overview

Package search provides functions for searching content for a given string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...option) (search, error)

New creates a searcher with optional input and output. It uses stdout and stdin as default values for input and output. It returns an error if one of the provided options errors.

func Search(term string)

Search uses defult searcher for searching lines that contain the given string. Default searcher uses stdin and stdout for input and output. Search panics if the searcher with default settings returns an error.

func WithInput

func WithInput(r io.Reader) option

WithInput sets input source for the searcher. It errors when the provided input is nil.

func WithOutput

func WithOutput(w io.Writer) option

WithOutput sets output for the searcher. It errors when the provided output is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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