Skip to content

Commit

Permalink
Merge pull request #18 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.3.2
  • Loading branch information
andyone authored Oct 20, 2018
2 parents ac0795e + 907de47 commit e6dae5f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ sudo: required
language: go

go:
- 1.8.x
- 1.9.x
- 1.10.x
- 1.11.x
- tip

os:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {} \;
Expand Down
5 changes: 4 additions & 1 deletion common/yo.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -92,6 +92,9 @@ rm -rf %{buildroot}
################################################################################

%changelog
* Wed Oct 17 2018 Anton Novojilov <[email protected]> - 0.3.2-0
- go-simpleyaml updated to v2

* Tue Mar 27 2018 Anton Novojilov <[email protected]> - 0.3.1-0
- ek package updated to latest stable release

Expand Down
16 changes: 8 additions & 8 deletions yo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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))
}
}
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e6dae5f

Please sign in to comment.