summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/pelletier/go-toml/cmd/tomll
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-06 21:47:05 +0200
committerWim <wim@42.be>2018-08-06 21:47:05 +0200
commit51062863a5c34d81e296cf15c61140911037cf3b (patch)
tree9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/pelletier/go-toml/cmd/tomll
parent4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff)
downloadmatterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/pelletier/go-toml/cmd/tomll')
-rw-r--r--vendor/github.com/pelletier/go-toml/cmd/tomll/main.go66
1 files changed, 0 insertions, 66 deletions
diff --git a/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go b/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go
deleted file mode 100644
index 36c7e375..00000000
--- a/vendor/github.com/pelletier/go-toml/cmd/tomll/main.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Tomll is a linter for TOML
-//
-// Usage:
-// cat file.toml | tomll > file_linted.toml
-// tomll file1.toml file2.toml # lint the two files in place
-package main
-
-import (
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "os"
-
- "github.com/pelletier/go-toml"
-)
-
-func main() {
- flag.Usage = func() {
- fmt.Fprintln(os.Stderr, `tomll can be used in two ways:
-Writing to STDIN and reading from STDOUT:
- cat file.toml | tomll > file.toml
-
-Reading and updating a list of files:
- tomll a.toml b.toml c.toml
-
-When given a list of files, tomll will modify all files in place without asking.
-`)
- }
- flag.Parse()
- // read from stdin and print to stdout
- if flag.NArg() == 0 {
- s, err := lintReader(os.Stdin)
- if err != nil {
- io.WriteString(os.Stderr, err.Error())
- os.Exit(-1)
- }
- io.WriteString(os.Stdout, s)
- } else {
- // otherwise modify a list of files
- for _, filename := range flag.Args() {
- s, err := lintFile(filename)
- if err != nil {
- io.WriteString(os.Stderr, err.Error())
- os.Exit(-1)
- }
- ioutil.WriteFile(filename, []byte(s), 0644)
- }
- }
-}
-
-func lintFile(filename string) (string, error) {
- tree, err := toml.LoadFile(filename)
- if err != nil {
- return "", err
- }
- return tree.String(), nil
-}
-
-func lintReader(r io.Reader) (string, error) {
- tree, err := toml.LoadReader(r)
- if err != nil {
- return "", err
- }
- return tree.String(), nil
-}