config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config is responsible for setting the program config from command-line arguments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFindSlice

func SetFindSlice(s []string)

func SetFindStringRegex

func SetFindStringRegex(replacementIndex int) error

func SetNumberOffset

func SetNumberOffset(offset []int)

func SetReplacement

func SetReplacement(replacement string)

func SetReplacementSlice

func SetReplacementSlice(s []string)

Types

type Config

type Config struct {
	Date               time.Time
	Stdin              io.Reader
	Stderr             io.Writer
	Stdout             io.Writer
	SearchRegex        *regexp.Regexp
	CSVFilename        string
	Sort               string
	Replacement        string
	WorkingDir         string
	FindSlice          []string
	ExcludeFilter      []string
	ReplacementSlice   []string
	PathsToFilesOrDirs []string
	NumberOffset       []int
	MaxDepth           int
	StartNumber        int
	ReplaceLimit       int
	Recursive          bool
	IgnoreCase         bool
	ReverseSort        bool
	OnlyDir            bool
	Revert             bool
	IncludeDir         bool
	IgnoreExt          bool
	AllowOverwrites    bool
	Verbose            bool
	IncludeHidden      bool
	Quiet              bool
	AutoFixConflicts   bool
	Exec               bool
	StringLiteralMode  bool
	SimpleMode         bool
	JSON               bool
}

Config represents the program configuration.

func Init

func Init(ctx *cli.Context) (*Config, error)

func (*Config) SetFindStringRegex

func (c *Config) SetFindStringRegex(replacementIndex int) error

SetFindStringRegex compiles a regular expression for the find string of the corresponding replacement index (if any). Otherwise, the created regex will match the entire file name.

Jump to

Keyboard shortcuts

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