Documentation
¶
Overview ¶
Package config is responsible for setting the program config from command-line arguments
Index ¶
Constants ¶
const ( EnvNoColor = "NO_COLOR" EnvF2NoColor = "F2_NO_COLOR" )
const ( DefaultFixConflictsPattern = "(%d)" DefaultWorkingDir = "." )
Variables ¶
Functions ¶
Types ¶
type Backup ¶
type Config ¶
type Config struct {
Date time.Time `json:"date"`
BackupLocation io.Writer `json:"-"`
ExcludeDirRegex *regexp.Regexp `json:"exclude_dir_regex"`
ExcludeRegex *regexp.Regexp `json:"exclude_regex"`
Search *Search `json:"search_regex"`
FixConflictsPatternRegex *regexp.Regexp `json:"fix_conflicts_pattern_regex"`
Replacement string `json:"replacement"`
WorkingDir string `json:"working_dir"`
FixConflictsPattern string `json:"fix_conflicts_pattern"`
CSVFilename string `json:"csv_filename"`
BackupFilename string `json:"backup_filename"`
TargetDir string `json:"target_dir"`
SortVariable string `json:"sort_variable"`
ExiftoolOpts ExiftoolOpts `json:"exiftool_opts"`
PairOrder []string `json:"pair_order"`
FindSlice []string `json:"find_slice"`
FilesAndDirPaths []string `json:"files_and_dir_paths"`
ReplacementSlice []string `json:"replacement_slice"`
ReplaceLimit int `json:"replace_limit"`
StartNumber int `json:"start_number"`
MaxDepth int `json:"max_depth"`
Sort Sort `json:"sort"`
Revert bool `json:"revert"`
IncludeDir bool `json:"include_dir"`
IgnoreExt bool `json:"ignore_ext"`
IgnoreCase bool `json:"ignore_case"`
Verbose bool `json:"verbose"`
IncludeHidden bool `json:"include_hidden"`
Quiet bool `json:"quiet"`
NoColor bool `json:"no_color"`
AutoFixConflicts bool `json:"auto_fix_conflicts"`
Exec bool `json:"exec"`
StringLiteralMode bool `json:"string_literal_mode"`
JSON bool `json:"json"`
Debug bool `json:"debug"`
Recursive bool `json:"recursive"`
ResetIndexPerDir bool `json:"reset_index_per_dir"`
OnlyDir bool `json:"only_dir"`
PipeOutput bool `json:"is_output_to_pipe"`
ReverseSort bool `json:"reverse_sort"`
AllowOverwrites bool `json:"allow_overwrites"`
Pair bool `json:"pair"`
SortPerDir bool `json:"sort_per_dir"`
Clean bool `json:"clean"`
}
Config represents the program configuration.
func Get ¶
func Get() *Config
Get retrives an already set config or panics if the configuration has not yet been initialized.
func (*Config) SetFindStringRegex ¶
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. It takes into account the StringLiteralMode and IgnoreCase options.
If a find string exists for the given replacementIndex, it's used as the pattern. Otherwise, the pattern defaults to ".*" to match the entire file name.
Returns an error if the regex compilation fails.
type ExiftoolOpts ¶
type ExiftoolOpts struct {
API string `long:"api" json:"api"` // corresponds to the `-api` flag
Charset string `long:"charset" json:"charset"` // corresponds to the `-charset` flag
CoordFormat string `long:"coordFormat" json:"coord_format"` // corresponds to the `-coordFormat` flag
DateFormat string `long:"dateFormat" json:"date_format"` // corresponds to the `-dateFormat` flag
ExtractEmbedded bool `long:"extractEmbedded" json:"extract_embedded"` // corresponds to the `-extractEmbedded` flag
}
ExiftoolOpts defines supported options for customizing Exitool's output.