virtigo/argv.go

50 lines
1.5 KiB
Go
Raw Normal View History

package main
import "go.wit.com/log"
/*
this parses the command line arguements
this enables command line options from other packages like 'gui' and 'log'
*/
var argv args
type args struct {
Dir string `arg:"--dir" help:"defaults to ~/.config/virtigo/"`
Port int `arg:"--port" default:"8080" help:"specify a different default port"`
Hosts []string `arg:"--hosts" help:"hosts to connect to"`
Uptime bool `arg:"--uptime" default:"true" help:"allow uptime checks for things like Kuma"`
Daemon bool `arg:"--daemon" help:"run in daemon mode"`
Xml []string `arg:"--add-xml" help:"add libvirt xml files"`
Save bool `arg:"--save" default:"false" help:"save xml changes to the protobuf values"`
}
func (a args) Description() string {
return `
virtigo will help control your cluster of hypervisiors
go install go.wit.com/apps/virtigo@latest
`
}
func (args) Version() string {
return "virtigo " + Version
}
var INFO *log.LogFlag
var POLL *log.LogFlag
var WARN *log.LogFlag
var SPEW *log.LogFlag
var EVENT *log.LogFlag
func init() {
full := "go.wit.com/apps/virtigo"
short := "virtigo"
INFO = log.NewFlag("INFO", false, full, short, "general virtigo")
POLL = log.NewFlag("POLL", false, full, short, "virtigo polling")
SPEW = log.NewFlag("SPEW", true, full, short, "bad things")
EVENT = log.NewFlag("EVENT", true, full, short, "hypeprvisor/droplet events")
}