1
0
Fork 0

Big rafactoring : code split in several modules and some other best practices

This commit is contained in:
Julien Dessaux 2020-01-30 17:44:42 +01:00
parent e07ce016c4
commit bea8e5aba8
16 changed files with 506 additions and 386 deletions

16
config/init.go Normal file
View file

@ -0,0 +1,16 @@
package config
import "flag"
// Init initialises a program config from the command line flags
func (c *Config) Init() {
flag.BoolVar(&c.verbose, "v", false, "Activates verbose debugging output, defaults to false.")
flag.BoolVar(&c.quiet, "q", false, "Suppress all output, suitable to force a silent update of the spool file.")
flag.StringVar(&c.stateFile, "f", "", "Force the state file to use, defaults to "+bareosStateFile+" if it exists else "+baculaStateFile+".")
flag.StringVar(&c.workDir, "w", "", "Force the work directory to use, defaults to "+bareosWorkDir+" if it exists else "+baculaWorkDir+".")
// command line arguments parsing
flag.Parse()
c.checkWorkDir()
c.checkStateFile()
}