Skip to content

Commit

Permalink
Merge pull request #276 from Annopaolo/aliases-and-attributes-are-maps
Browse files Browse the repository at this point in the history
`appengine device {aliases | attribues} list`: show a human-readable map
  • Loading branch information
matt-mazzucato authored Nov 12, 2024
2 parents a3c5e93 + 1ea8ca8 commit 919a628
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [24.5.3] - Unreleased
### Changed
- `appengine device attributes list`: display attributes in a human-friendly
representation instead Go's internal one. Keep consistency with aliases.

### Fixed
- `appengine device alias list`: show aliases as a map instead of a list.
Fix [#275](https://github.com/astarte-platform/astartectl/issues/275).

## [24.5.2] - 2024-09-20
### Fixed
- Allow a larger set of permissions for configuration files and folders.
Expand Down
6 changes: 5 additions & 1 deletion cmd/appengine/device_aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ func aliasesListF(command *cobra.Command, args []string) error {
os.Exit(1)
}
aliases, _ := deviceAliasesRes.Parse()
aliasesMap, _ := aliases.(map[string]string)

for k, v := range aliasesMap {
fmt.Printf("%v: %v\n", k, v)
}

fmt.Printf("%v\n", aliases)
return nil
}

Expand Down
6 changes: 5 additions & 1 deletion cmd/appengine/device_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ func attributesListF(command *cobra.Command, args []string) error {
os.Exit(1)
}
attributes, _ := attributesRes.Parse()
attributesMap, _ := attributes.(map[string]string)

for k, v := range attributesMap {
fmt.Printf("%v: %v\n", k, v)
}

fmt.Printf("%v\n", attributes)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5
github.com/Masterminds/semver/v3 v3.1.1
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/astarte-platform/astarte-go v0.92.1
github.com/astarte-platform/astarte-go v0.92.2-0.20241112115810-b8a1c0732cf1
github.com/go-openapi/strfmt v0.21.1 // indirect
github.com/google/go-cmp v0.5.8
github.com/google/go-github/v30 v30.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/astarte-platform/astarte-go v0.92.1 h1:9zUiw1E4uj2wBDeszxGh/IAnVFg7BDKhRWqioksG0WA=
github.com/astarte-platform/astarte-go v0.92.1/go.mod h1:JY2jLeZoUP9o8+IZSIR595FgdjBj1vdYv4KuJ+tmq1U=
github.com/astarte-platform/astarte-go v0.92.2-0.20241112115810-b8a1c0732cf1 h1:E+mIQLxInwu5VwMjrmPvqB4bqJFBw2SUHzGkr/aZ9oI=
github.com/astarte-platform/astarte-go v0.92.2-0.20241112115810-b8a1c0732cf1/go.mod h1:JY2jLeZoUP9o8+IZSIR595FgdjBj1vdYv4KuJ+tmq1U=
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down

0 comments on commit 919a628

Please sign in to comment.