cli

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cli provides utilities for frizbee's CLI.

Package cli provides utilities for frizbee's CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeclareReplacerFlags

func DeclareReplacerFlags(cmd *cobra.Command)

DeclareReplacerFlags declares the flags common to all replacer commands. Note that `dir` is not declared here because it is command-specific.

func ProcessDirNameForBillyFS

func ProcessDirNameForBillyFS(dir string) string

ProcessDirNameForBillyFS processes the given directory name for use with go-billy filesystems.

Types

type Replacer

type Replacer struct {
	Dir           string
	DryRun        bool
	Quiet         bool
	ErrOnModified bool
	Cmd           *cobra.Command
}

Replacer is a common struct for implementing a CLI command that replaces files.

func (*Replacer) Logf

func (r *Replacer) Logf(format string, args ...interface{})

Logf logs the given message to the given command's stderr if the command is not quiet.

func (*Replacer) ProcessOutput

func (r *Replacer) ProcessOutput(bfs billy.Filesystem, outfiles map[string]string) error

ProcessOutput processes the given output files. If the command is quiet, the output is discarded. If the command is a dry run, the output is written to the command's stdout. Otherwise, the output is written to the given filesystem.

Jump to

Keyboard shortcuts

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