First commit
This commit is contained in:
commit
902f6513ff
8 changed files with 130 additions and 0 deletions
24
args/args.go
Normal file
24
args/args.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package args
|
||||
|
||||
/* This file manages declaration of, parsing of, and returning copies of
|
||||
command line arguments. */
|
||||
|
||||
import "flag"
|
||||
|
||||
/* Method to trigger flag parsing. Can be called multiple times safely. */
|
||||
func Parse() {
|
||||
if (flagsParsed) {return}
|
||||
flag.Parse();
|
||||
flagsParsed = true;
|
||||
}
|
||||
/* module-specific variable to avoid re-parsing flags */
|
||||
var flagsParsed bool = false;
|
||||
|
||||
/* what JSON file to read config values from */
|
||||
var confLocation = flag.String("conf", "./config.txt", "Config file to read from")
|
||||
/* Returns nil if flags are not parsed yet
|
||||
@return set boolean will be true if argument is not nil */
|
||||
func GetConfLocation() (location string, set bool) {
|
||||
if confLocation == nil {return "", false}
|
||||
return *confLocation, true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue