summaryrefslogtreecommitdiff
path: root/argv.go
blob: 6ec3a721aca33fde4908f81e16b1aec54f763b43 (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
package main

import (
	"os"

	"go.wit.com/dev/alexflint/arg"
	"go.wit.com/gui"
)

/*
	this parses the command line arguements
	this enables command line options from other packages like 'gui' and 'log'
*/

var argv args

type args struct {
	Demo string `arg:"positional"                   help:"this is just a demo"`
}

func (a args) Description() string {
	return `
This basicwindow example demonstrates multiple windows
`
}

func init() {
	gui.InitArg()
	pp := arg.MustParse(&argv)

	// for very new users or users unfamilar with the command line, this may help them
	if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" {
		pp.WriteHelp(os.Stdout)
		os.Exit(0)
	}
}

func (args) Version() string {
	return "basicwindow " + VERSION
}