diff --git a/.travis.yml b/.travis.yml index 96c934b..089ba59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,8 @@ sudo: required language: go go: - - 1.8.x - - 1.9.x - 1.10.x + - 1.11.x - tip os: diff --git a/Makefile b/Makefile index 8727542..0e29699 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ uninstall: ## Uninstall binaries deps: ## Download dependencies git config --global http.https://pkg.re.followRedirects true go get -d -v pkg.re/essentialkaos/ek.v9 - go get -d -v pkg.re/essentialkaos/go-simpleyaml.v1 + go get -d -v pkg.re/essentialkaos/go-simpleyaml.v2 fmt: ## Format source code with gofmt find . -name "*.go" -exec gofmt -s -w {} \; diff --git a/common/yo.spec b/common/yo.spec index 4eb57bb..83340f3 100644 --- a/common/yo.spec +++ b/common/yo.spec @@ -44,7 +44,7 @@ Summary: Command-line YAML processor Name: yo -Version: 0.3.1 +Version: 0.3.2 Release: 0%{?dist} Group: Applications/System License: EKOL @@ -92,6 +92,9 @@ rm -rf %{buildroot} ################################################################################ %changelog +* Wed Oct 17 2018 Anton Novojilov - 0.3.2-0 +- go-simpleyaml updated to v2 + * Tue Mar 27 2018 Anton Novojilov - 0.3.1-0 - ek package updated to latest stable release diff --git a/yo.go b/yo.go index e3a4991..c8b4084 100644 --- a/yo.go +++ b/yo.go @@ -21,14 +21,14 @@ import ( "pkg.re/essentialkaos/ek.v9/options" "pkg.re/essentialkaos/ek.v9/usage" - "pkg.re/essentialkaos/go-simpleyaml.v1" + "pkg.re/essentialkaos/go-simpleyaml.v2" ) // ////////////////////////////////////////////////////////////////////////////////// // const ( APP = "Yo" - VER = "0.3.1" + VER = "0.3.2" DESC = "Command-line YAML processor" ) @@ -198,11 +198,11 @@ func execArrayTokenSelector(t Token, data []*simpleyaml.Yaml) []*simpleyaml.Yaml for _, index := range t.Index { if t.Key == "" { if item.IsIndexExist(index) { - result = append(result, item.GetIndex(index)) + result = append(result, item.GetByIndex(index)) } } else { if item.Get(t.Key).IsIndexExist(index) { - result = append(result, item.Get(t.Key).GetIndex(index)) + result = append(result, item.Get(t.Key).GetByIndex(index)) } } } @@ -221,13 +221,13 @@ func execArrayTokenSelector(t Token, data []*simpleyaml.Yaml) []*simpleyaml.Yaml for index := t.Range.Start; index < t.Range.End; index++ { if t.Key == "" { if item.IsIndexExist(index) { - result = append(result, item.GetIndex(index)) + result = append(result, item.GetByIndex(index)) } else { break RANGELOOP } } else { if item.Get(t.Key).IsIndexExist(index) { - result = append(result, item.Get(t.Key).GetIndex(index)) + result = append(result, item.Get(t.Key).GetByIndex(index)) } else { break RANGELOOP } @@ -257,7 +257,7 @@ func renderData(data []*simpleyaml.Yaml) { for _, item := range data { switch { case item.IsArray(): - if item.GetIndex(0).IsMap() || item.GetIndex(0).IsArray() { + if item.GetByIndex(0).IsMap() || item.GetByIndex(0).IsArray() { encodeYaml(item) } else { fmt.Println(strings.Join(item.MustStringArray(nil), "\n")) @@ -312,7 +312,7 @@ func processorFuncLength(data []*simpleyaml.Yaml, k interface{}) []int { for _, item := range data { switch { case item.IsArray(): - result = append(result, item.ArraySize()) + result = append(result, len(item.MustArray(nil))) case item.IsMap(): result = append(result, len(item.MustMap(nil))) default: