Skip to content
Permalink
Browse files

Started implementing editor.

  • Loading branch information...
dihedron committed Jun 7, 2017
1 parent babcab4 commit b0dfa1df7757c80cb9f0f8dba37eb3ca49598219
Showing with 24 additions and 1 deletion.
  1. +24 −1 main.go
25 main.go
@@ -1,14 +1,37 @@
package main

import (
"encoding/xml"
"os"

"github.com/hashicorp/terraform/plugin"
)

func main() {
if len(os.Args) > 1 {
// TODO: editor mode
// editor mode
file, _ := os.Open(os.Args[1])
d := xml.NewDecoder(file)
for {
t, tokenErr := d.Token()
if tokenErr != nil {
// TODO: log error
}
switch t := t.(type) {
case xml.StartElement:
if t.Name.Space == "foo" && t.Name.Local == "bar" {
/*
var b bar
if err := d.DecodeElement(&b, &t); err != nil {
// handle error
}
*/
// do something with b
}
// TODO: add other cases
}
}

} else {
// terraform plugin mode
plugin.Serve(&plugin.ServeOpts{

0 comments on commit b0dfa1d

Please sign in to comment.
You can’t perform that action at this time.