go_tab-magic/cmd/main.go

39 lines
836 B
Go
Raw Normal View History

2018-11-27 04:56:21 +00:00
package main
import (
"flag"
"log"
"git.linuxrocker.com/mattburchett/go_tab-magic/pkg/config"
"git.linuxrocker.com/mattburchett/go_tab-magic/pkg/resolver"
2018-11-30 20:20:43 +00:00
"git.linuxrocker.com/mattburchett/go_tab-magic/pkg/shell"
2018-11-27 04:56:21 +00:00
)
func main() {
var c string
2018-11-30 20:20:43 +00:00
var user string
2018-11-27 04:56:21 +00:00
var debug bool
flag.StringVar(&c, "config", "", "Configuration to load")
2018-11-30 20:20:43 +00:00
flag.StringVar(&user, "user", "", "user for aliases")
2018-11-27 04:56:21 +00:00
flag.BoolVar(&debug, "debug", false, "Enables Debugging Mode")
flag.Parse()
// Stop the app if they're missing required flags.
if c == "" {
log.Fatal("You need to specify a configuration file.")
}
2018-11-30 20:20:43 +00:00
if user == "" {
2018-12-05 23:12:43 +00:00
log.Fatal("You must specify a username.")
2018-11-30 20:20:43 +00:00
}
2018-11-27 04:56:21 +00:00
cfg, err := config.GetConfig(c, debug)
if err != nil {
log.Fatal(err)
}
2018-11-30 20:20:43 +00:00
data := resolver.PerformZoneTransfer(cfg)
shell.CreateShellAliases(data, user, cfg)
2018-11-27 04:56:21 +00:00
}