aboutsummaryrefslogtreecommitdiff
path: root/config/init.go
blob: f737fb3eeb82fef58b151f0a2d5d2e5a9b93165f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()
}