config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringModeUnknown = "unknown"
	StringModeVersion = "version"
	StringModeQuery   = "query"
	StringModeDryrun  = "dryrun"
	StringModeList    = "list"
)
View Source
const (
	ModeUnknown = Mode(StringModeUnknown)
	ModeVersion = Mode(StringModeVersion)
	ModeQuery   = Mode(StringModeQuery)
	ModeDryrun  = Mode(StringModeDryrun)
	ModeList    = Mode(StringModeList)
)

Variables

View Source
var (
	ErrInvalidSource = errors.New("InvalidSource")
	ErrInvalidQuery  = errors.New("InvalidQuery")
	ErrStdinConflict = errors.New("StdinConflict")
	ErrInvalidInput  = errors.New("InvalidInput")
	ErrNoSources     = errors.New("NoSources")
)
View Source
var ErrUnknownMode = errors.New("UnknownMode")

Functions

func DescribeSourceUsage

func DescribeSourceUsage() string

func IsStdinSource

func IsStdinSource(s iox.Source) bool

func NewIndexSource

func NewIndexSource(v string) (iox.Source, error)

func NewPathSource

func NewPathSource(v string) (iox.Walker, iox.Source, error)

func NewQuerySource

func NewQuerySource(v string) (iox.Source, error)

func NewSource

func NewSource(v string) (iox.Source, error)

func NewSourceOrRaw

func NewSourceOrRaw(v string) (iox.Source, error)

func ReadInputFromSource

func ReadInputFromSource(s iox.Source, noValidate bool) iter.Seq[*node.Node]

func ReadInputFromWalker

func ReadInputFromWalker(w iox.Walker) iter.Seq[*node.Node]

Types

type Config

type Config struct {
	Debug   bool `name:"debug" usage:"enable debug logs"`
	Trace   bool `name:"trace" usage:"enable trace logs"`
	Verbose bool `name:"verbose" short:"v" usage:"enable verbose output"`

	Index     string `name:"index" short:"i" usage:"index source; exclusive with paths"`
	RawOutput bool   `name:"raw" usage:"enable raw output"`

	Mode  Mode     `name:"-"`
	Query string   `name:"-"`
	Path  string   `name:"-"`
	Args  []string `name:"-"`

	Stdout  io.Writer `name:"-"`
	Stderr  io.Writer `name:"-"`
	Sources *Sources  `name:"-"`
}

func (*Config) Close

func (c *Config) Close() error

func (Config) SetupLogger

func (c Config) SetupLogger()

func (*Config) SetupQuery

func (c *Config) SetupQuery() error

func (*Config) SetupSources

func (c *Config) SetupSources() error

func (*Config) WriteNode

func (c *Config) WriteNode(n *node.Node)

type Mode

type Mode string

Mode specifies the execution mode for ndql.

func NewMode

func NewMode(v string) Mode

func (Mode) String

func (m Mode) String() string

type Sources

type Sources struct {
	Query iox.Source
	Path  iox.Walker

	Index iox.Source
	// contains filtered or unexported fields
}

func (*Sources) Close

func (s *Sources) Close() error

func (*Sources) HasStdinConflict

func (s *Sources) HasStdinConflict() bool

func (*Sources) ReadInput

func (s *Sources) ReadInput() (iter.Seq[*node.Node], error)

Jump to

Keyboard shortcuts

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