Skip to content

Commit

Permalink
Add default_label_name to JSON output of buf registry module info (
Browse files Browse the repository at this point in the history
…#3387)

Co-authored-by: bufdev <4228796+bufdev@users.noreply.github.com>
  • Loading branch information
doriable and bufdev authored Oct 7, 2024
1 parent 43e16ef commit 84bb6b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## [Unreleased]

- No changes yet.
- Update `buf registry module info --format=json` to add `default_label_name, which provides the name
of the default label of a module.

## [v1.44.0] - 2024-10-03

Expand Down
30 changes: 16 additions & 14 deletions private/buf/bufprint/bufprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ func NewCommitEntity(commit *modulev1.Commit, moduleFullName bufmodule.ModuleFul
// NewModuleEntity returns a new module entity to print.
func NewModuleEntity(module *modulev1.Module, moduleFullName bufmodule.ModuleFullName) Entity {
return outputModule{
ID: module.Id,
Remote: moduleFullName.Registry(),
Owner: moduleFullName.Owner(),
Name: moduleFullName.Name(),
FullName: moduleFullName.String(),
CreateTime: module.CreateTime.AsTime(),
State: module.State.String(),
ID: module.Id,
Remote: moduleFullName.Registry(),
Owner: moduleFullName.Owner(),
Name: moduleFullName.Name(),
FullName: moduleFullName.String(),
CreateTime: module.CreateTime.AsTime(),
State: module.State.String(),
DefaultLabelName: module.GetDefaultLabelName(),
}
}

Expand Down Expand Up @@ -430,13 +431,14 @@ func (c outputCommit) fullName() string {
}

type outputModule struct {
ID string `json:"id,omitempty"`
Remote string `json:"remote,omitempty"`
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
FullName string `json:"-" bufprint:"Name"`
CreateTime time.Time `json:"create_time,omitempty" bufprint:"Create Time"`
State string `json:"state,omitempty"`
ID string `json:"id,omitempty"`
Remote string `json:"remote,omitempty"`
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
FullName string `json:"-" bufprint:"Name"`
CreateTime time.Time `json:"create_time,omitempty" bufprint:"Create Time"`
State string `json:"state,omitempty"`
DefaultLabelName string `json:"default_label_name,omitempty"`
}

func (m outputModule) fullName() string {
Expand Down

0 comments on commit 84bb6b5

Please sign in to comment.