plan

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package plan provides functions that are associated with the Plan and the type of the same name.

Index

Constants

This section is empty.

Variables

L contains the Logger used to log stuff

Functions

This section is empty.

Types

type Plan

type Plan struct {
	// TempID contains the id of the Plan (i.e. the unique identifier of the job.
	TempID string
	// InFiles contains the paths of the files before renaming
	InFiles []string
	// OutFiles contains the paths of the files after renaming
	OutFiles []string

	// AbsolutePaths indicates whether to use absolute paths or not
	AbsolutePaths bool
	// Overwrite indicates whether existing files shall be overwritten
	Overwrite bool
	// Editor contains the Editor to use for editing
	Editor string
	// EditorArgs contains the arguments that will be passed to the editor. {} will be replaced by the absolute path to the plan-file.
	EditorArgs []string
	// CreateDirs indicates whether non-existent directories should be created as needed
	CreateDirs bool
	// StopToShow indicates whether an overview of the applied actions should be shown and confirmation requested
	StopToShow bool
	// DeleteEmpty indicates whether files corresponding with empty lines should be deleted
	DeleteEmpty bool
	// contains filtered or unexported fields
}

Plan stores all information on a rename-job. and provides related funtions.

func NewPlan

func NewPlan() *Plan

NewPlan returns a pointer to a new Plan

func (*Plan) CreatePlan

func (p *Plan) CreatePlan(planfile string) error

CreatePlan reads the new filenames from the temporary file

func (*Plan) Execute

func (p *Plan) Execute() (errOccured bool, errorDescs []string, errs []error)

Execute iterates over the jobs and executes them

func (*Plan) GetFileList

func (p *Plan) GetFileList() []string

GetFileList returns a list of the files to edit

func (*Plan) LoadFileList

func (p *Plan) LoadFileList(files []string, recursive bool)

LoadFileList loads the list of files into the Plan-Type

func (*Plan) PrepareExecution

func (p *Plan) PrepareExecution() error

PrepareExecution creates a set of prerules that need to be executed in order to execute the actual plan.

func (*Plan) PreviewPlan

func (p *Plan) PreviewPlan()

PreviewPlan prints a preview of the plan that is to be executed

func (*Plan) StartEditing

func (p *Plan) StartEditing() error

StartEditing launches the editor and loads the required file for editing

func (*Plan) TempFile

func (p *Plan) TempFile() string

TempFile returns the path to the temporary file

Directories

Path Synopsis
Package jobdescriptor provides a type to store information of a job in
Package jobdescriptor provides a type to store information of a job in

Jump to

Keyboard shortcuts

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