virtigoctl/argv.go

52 lines
1.8 KiB
Go
Raw Normal View History

2024-10-30 02:28:53 -05:00
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 {
Xml []string `arg:"--libvirt" help:"import qemu xml files: --libvirt /etc/libvirt/qemu/*.xml"`
IgnoreCpu bool `arg:"--xml-ignore-cpu" default:"true" help:"ignore non-standard libvirt xml cpus"`
IgnoreBr bool `arg:"--xml-ignore-net" default:"true" help:"ignore network bridge name changes"`
IgnDisk bool `arg:"--xml-ignore-disk" default:"false" help:"ignore duplicate disk names"`
Port int `arg:"--port" default:"8080" help:"allow droplet events via http"`
Hosts []string `arg:"--hosts" help:"hosts to connect to"`
}
// Save bool `arg:"--save" default:"false" help:"save protobuf config after import"`
// Start string `arg:"--start" help:"start a droplet"`
// Uptime bool `arg:"--uptime" default:"true" help:"allow uptime checks for things like Kuma"`
func (a args) Description() string {
return `
virtigoctl command line configure and control for virtigo
`
}
func (args) Version() string {
return "virtigoctl " + 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/virtigoctl"
short := "virtigoctl"
INFO = log.NewFlag("INFO", false, full, short, "general virtigo")
POLL = log.NewFlag("POLL", false, full, short, "virtigo polling")
WARN = log.NewFlag("WARN", true, full, short, "bad things")
SPEW = log.NewFlag("SPEW", true, full, short, "dump everything")
EVENT = log.NewFlag("EVENT", true, full, short, "hypeprvisor/droplet events")
}