cli

package
v0.13.158 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli provides CLI app and global flags

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cli

type Cli struct {
	Version ctl.VersionFlag `name:"version" help:"Print version information and quit" hidden:""`
	Debug   bool            `short:"D" help:"Enable debug mode"`
	O       string          `help:"Print output format: json|yaml|table" default:"table"`

	SQLSource string `help:"SQL sources, if not provided, will be used from XDB_DATASOURCE env var"`
	// contains filtered or unexported fields
}

Cli provides CLI context to run commands

func (*Cli) AfterApply

func (c *Cli) AfterApply(_ *kong.Kong, _ kong.Vars) error

AfterApply hook loads config

func (*Cli) Close

func (c *Cli) Close()

Close used resources

func (*Cli) Context

func (c *Cli) Context() context.Context

Context for requests

func (*Cli) DB

func (c *Cli) DB(dbname string) (xdb.Provider, error)

DB returns DB connection

func (*Cli) ErrWriter

func (c *Cli) ErrWriter() io.Writer

ErrWriter returns a writer for control output

func (*Cli) Print

func (c *Cli) Print(value any) error

Print response to out

func (*Cli) Reader

func (c *Cli) Reader() io.Reader

Reader is the source to read from, typically set to os.Stdin

func (*Cli) SchemaProvider

func (c *Cli) SchemaProvider(dbname string) (schema.Provider, error)

SchemaProvider returns schema.Provider

func (*Cli) WithErrWriter

func (c *Cli) WithErrWriter(out io.Writer) *Cli

WithErrWriter allows to specify a custom error writer

func (*Cli) WithReader

func (c *Cli) WithReader(reader io.Reader) *Cli

WithReader allows to specify a custom reader

func (*Cli) WithSchemaProvider

func (c *Cli) WithSchemaProvider(p schema.Provider) *Cli

WithSchemaProvider allows to specify a custom schema provider

func (*Cli) WithWriter

func (c *Cli) WithWriter(out io.Writer) *Cli

WithWriter allows to specify a custom writer

func (*Cli) Writer

func (c *Cli) Writer() io.Writer

Writer returns a writer for control output

Directories

Path Synopsis
Package clisuite to test CLI commands
Package clisuite to test CLI commands
Package schema provides CLI commands
Package schema provides CLI commands

Jump to

Keyboard shortcuts

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