diff options
Diffstat (limited to 'examples/cloudflare')
| -rw-r--r-- | examples/cloudflare/Makefile | 24 | ||||
| -rw-r--r-- | examples/cloudflare/argv.go | 30 | ||||
| -rw-r--r-- | examples/cloudflare/config.go | 71 | ||||
| -rw-r--r-- | examples/cloudflare/main.go | 52 |
4 files changed, 0 insertions, 177 deletions
diff --git a/examples/cloudflare/Makefile b/examples/cloudflare/Makefile deleted file mode 100644 index 32f3f55..0000000 --- a/examples/cloudflare/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -run: build - ./cloudflare - -build-release: - go get -v -u -x . - go build - ./cloudflare - -build: - GO111MODULE="off" go get -v -x . - GO111MODULE="off" go build - -update: - GO111MODULE="off" go get -v -u -x . - -log: - reset - tail -f /tmp/witgui.* /tmp/guilogfile - -gocui: build - ./cloudflare -gui gocui >/tmp/witgui.log.stderr 2>&1 - -quiet: - ./cloudflare >/tmp/witgui.log.stderr 2>&1 diff --git a/examples/cloudflare/argv.go b/examples/cloudflare/argv.go deleted file mode 100644 index 49167cd..0000000 --- a/examples/cloudflare/argv.go +++ /dev/null @@ -1,30 +0,0 @@ -// This creates a simple hello world window -package main - -import ( - "fmt" - arg "github.com/alexflint/go-arg" - "go.wit.com/gui" - log "go.wit.com/gui/log" -) - - -var args struct { - Foo string - Bar bool - User string `arg:"env:USER"` - Demo bool `help:"run a demo"` - gui.GuiArgs - log.LogArgs -} - -func init() { - arg.MustParse(&args) - fmt.Println(args.Foo, args.Bar, args.User) - - if (args.Gui != "") { - gui.GuiArg.Gui = args.Gui - } - log.Log(true, "INIT() args.GuiArg.Gui =", gui.GuiArg.Gui) - -} diff --git a/examples/cloudflare/config.go b/examples/cloudflare/config.go deleted file mode 100644 index a65ad25..0000000 --- a/examples/cloudflare/config.go +++ /dev/null @@ -1,71 +0,0 @@ -// This is a simple example -package main - -import ( - "os" - "log" - "bufio" - "strings" - - "go.wit.com/control-panel-dns/cloudflare" -) - -func saveConfig() { - log.Println("TODO") -} - -func readConfig() { - homeDir, err := os.UserHomeDir() - if err != nil { - log.Println("searchPaths() error. exiting here?") - } - filename := homeDir + "/" + configfile - log.Println("filename =", filename) - - readFileLineByLine(filename) - // os.Exit(0) -} - -// readFileLineByLine opens a file and reads through each line. -func readFileLineByLine(filename string) error { - // Open the file. - file, err := os.Open(filename) - if err != nil { - return err - } - defer file.Close() - - log.Println("readFileLineByLine() =", filename) - - // Create a new Scanner for the file. - scanner := bufio.NewScanner(file) - - // Read through each line using scanner. - for scanner.Scan() { - var newc *cloudflare.ConfigT - newc = new(cloudflare.ConfigT) - - line := scanner.Text() - parts := strings.Fields(line) - - if (len(parts) < 4) { - log.Println("readFileLineByLine() SKIP =", parts) - continue - } - - newc.Domain = parts[0] - newc.ZoneID = parts[1] - newc.Auth = parts[2] - newc.Email = parts[3] - - cloudflare.Config[parts[0]] = newc - log.Println("readFileLineByLine() =", newc.Domain, newc.ZoneID, newc.Auth, newc.Email) - } - - // Check for errors during Scan. - if err := scanner.Err(); err != nil { - return err - } - - return nil -} diff --git a/examples/cloudflare/main.go b/examples/cloudflare/main.go deleted file mode 100644 index 2308478..0000000 --- a/examples/cloudflare/main.go +++ /dev/null @@ -1,52 +0,0 @@ -// This is a simple example -package main - -import ( - "go.wit.com/gui" - "go.wit.com/control-panel-dns/cloudflare" -) - -var title string = "Cloudflare DNS Control Panel" -var outfile string = "/tmp/guilogfile" -var configfile string = ".config/wit/cloudflare" - -var myGui *gui.Node - -// var buttonCounter int = 5 -// var gridW int = 5 -// var gridH int = 3 - -// var mainWindow, more, more2 *gui.Node - -// var cloudflareURL string = "https://api.cloudflare.com/client/v4/zones/" - -/* -var zonedrop *gui.Node -var domainWidget *gui.Node -var masterSave *gui.Node - -var zoneWidget *gui.Node -var authWidget *gui.Node -var emailWidget *gui.Node - -var loadButton *gui.Node -var saveButton *gui.Node -*/ - -func main() { - // parse the config file - readConfig() - - // initialize a new GO GUI instance - myGui = gui.New().Default() - - // draw the cloudflare control panel window - cloudflare.MakeCloudflareWindow(myGui) - - // This is just a optional goroutine to watch that things are alive - gui.Watchdog() - gui.StandardExit() - - // update the config file - saveConfig() -} |
