command

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FS          = "\t"
	DumpCommand = "dump"
)
View Source
const (
	CheckCommand = "check"
)
View Source
const (
	FixCommand = "fix"
)

Variables

This section is empty.

Functions

func SubCommand

func SubCommand(args ...string) (command *string, operands []string)

Types

type Check

type Check struct {
	CheckFix
	// contains filtered or unexported fields
}

Check is the check sub-command.

func NewCheck

func NewCheck(
	ctx context.Context,
	parser *applause.Parser,
	args ...string,
) (c *Check, err error)

func (*Check) Close

func (check *Check) Close() (err error)

type CheckFix added in v0.1.0

type CheckFix struct {
	Backup   bool               `option:"backup"`
	Dry      bool               `option:"dry-run|n"`
	Git      internal.GitOption `option:"git"`
	Jobs     uint64             `option:"jobs|j"`
	NoTools  []string           `option:"no-tool|T"`
	Paths    []string
	Progress string   `option:"progress|p"`
	Tools    []string `option:"tool|t"`
	// contains filtered or unexported fields
}

CheckFix is base for the check and fix sub-commands.

func (*CheckFix) Run added in v0.1.0

func (cf *CheckFix) Run(ctx context.Context) (err error)

type Command

type Command interface {
	io.Closer

	Run(ctx context.Context) error
}

type Dump

type Dump struct {
	Output

	Paths      []string
	Tools      []string `option:"tool|t"`
	Separator  string   `option:"separator|F"`
	SubCommand Command
	Null       bool `option:"null-terminated|z"`
	Sort       bool `option:"sort"`
}

func NewDump

func NewDump(
	ctx context.Context,
	parser *applause.Parser,
	args ...string,
) (*Dump, error)

func (*Dump) Close

func (d *Dump) Close() error

func (*Dump) Generate

func (d *Dump) Generate(context.Context) (elements [][]string, err error)

func (*Dump) Run

func (d *Dump) Run(ctx context.Context) error

type Files

type Files struct {
	// contains filtered or unexported fields
}

func NewFiles

func NewFiles(
	ctx context.Context,
	d *Dump,
	parser *applause.Parser,
	args ...string,
) (*Files, error)

func (*Files) Close

func (f *Files) Close() error

func (*Files) Run

func (f *Files) Run(ctx context.Context) error

type Fix

type Fix struct {
	CheckFix
}

func NewFix

func NewFix(
	ctx context.Context,
	parser *applause.Parser,
	args ...string,
) (f *Fix, err error)

func (*Fix) Close

func (fix *Fix) Close() error

type Generator

type Generator func(
	ctx context.Context,
	tool *spec.Tool,
	f *file.File,
) (record []string, err error)

type Output

type Output struct {
	Output string `option:"output|o"`
	// contains filtered or unexported fields
}

func (*Output) Close

func (w *Output) Close() error

func (*Output) Path added in v0.1.0

func (w *Output) Path() (path string, err error)

func (*Output) Writer

func (w *Output) Writer(ctx context.Context, wd string) (io.Writer, error)

type RootCommand

type RootCommand struct {
	Help bool `option:"help|h"`

	Washer internal.Washer

	SubCommand Command
}

func NewRootCommand

func NewRootCommand(ctx context.Context, args ...string) (*RootCommand, error)

func (*RootCommand) Close

func (cmd *RootCommand) Close() error

func (*RootCommand) Run

func (cmd *RootCommand) Run(ctx context.Context) error

type Spec

type Spec struct {
	Dump *Dump

	File bool `option:"file|f"`
}

func NewSpec

func NewSpec(
	ctx context.Context,
	l *Dump,
	parser *applause.Parser,
	args ...string,
) (*Spec, error)

func (*Spec) Close

func (*Spec) Close() error

func (*Spec) Run

func (s *Spec) Run(ctx context.Context) error

type Tools

type Tools struct {
	// contains filtered or unexported fields
}

func NewTools

func NewTools(
	ctx context.Context,
	d *Dump,
	parser *applause.Parser,
	args ...string,
) (*Tools, error)

func (*Tools) Close

func (t *Tools) Close() error

func (*Tools) Run

func (t *Tools) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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