summaryrefslogtreecommitdiff
path: root/argv.go
blob: 71b9d1d438e58e0333157f8c6fd3c41e50ab0203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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"`
	Save      bool     `arg:"--save"     default:"false"        help:"save protobuf config after import"`
	Config    string   `arg:"env:VIRTIGO_HOME"                  help:"defaults to ~/.config/virtigo/"`
	Port      int      `arg:"--port"     default:"8080"         help:"allow droplet events via http"`
	Daemon    bool     `arg:"--daemon"                          help:"run in daemon mode"`
	Start     string   `arg:"--start"                           help:"start a droplet"`
}

//	Uptime bool     `arg:"--uptime"   default:"true"    help:"allow uptime checks for things like Kuma"`
//	Hosts  []string `arg:"--hosts"                      help:"hosts to connect to"`

func (a args) Description() string {
	return `
         virtigo will help control your cluster

This maintains a master list of all your vm's (aka 'droplets')
in your homelab cloud.  You can import libvirt xml files. 
This app talks to your hypervisors via the virtigod daemon. 

Import your existing libvirt xml files with:

	virtigo --libvirt /etc/libvirt/qemu/*.xml --save

This runs a http server so you can control your virtual machines.
For example to start a vm called 'www.wit.com' your cluster 'foo.bar.com':

	curl http://foo.bar.com/start?www.wit.com
`
}

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")
	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")
}