converge

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package converge provides the command structure for the "converge" CLI tool. This command uses a FileConverger interface to merge multiple files from a source directory into a single file. The design allows for future support of different file types by implementing additional FileConverger variants.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

Command holds the configuration and dependencies for the "converge" command. If a destination file (dst) is specified, it takes precedence over the writer. Otherwise, output defaults to os.Stdout or the provided writer.

func NewCommand

func NewCommand(fc FileConverger, dir string, opts ...Option) *Command

NewCommand returns a new Command with standard defaults.

func (*Command) Run

func (c *Command) Run(ctx context.Context) error

Run runs the converge command.

type FileConverger

type FileConverger interface {
	// ConvergeFiles converges all files in the given directory and
	// package into one and writes the result to the given output.
	ConvergeFiles(ctx context.Context, dir string, w io.Writer) error
}

FileConverger is a type that can converge multiple files into one.

type Option

type Option func(*Command)

Option is a function that configures a Command.

func WithDstFile

func WithDstFile(dst string) Option

WithDstFile sets the destination file to use for the output.

func WithWriter

func WithWriter(w io.Writer) Option

WithWriter sets the writer to use for the output.

Jump to

Keyboard shortcuts

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