Skip to content

Commit

Permalink
Rebase merge Source details made more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
jnmoyne committed May 15, 2023
1 parent 8081ab5 commit a0178a4
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions cli/stream_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1720,23 +1720,29 @@ func (c *streamCmd) renderSource(s *api.StreamSource) string {
return ""
}

parts := []string{s.Name}
var parts []string

if s.FilterSubject == "" && s.SubjectTransformDest == "" {
parts = append(parts, s.Name)
} else {
var filter = ">"
if s.FilterSubject != "" {
filter = s.FilterSubject
}
if s.SubjectTransformDest != "" {
parts = append(parts, fmt.Sprintf("%s (%s to %s)", s.Name, filter, s.SubjectTransformDest))
} else {
parts = append(parts, fmt.Sprintf("%s (%s)", s.Name, s.FilterSubject))
}
}

if s.OptStartSeq > 0 {
parts = append(parts, fmt.Sprintf("Start Seq: %s", humanize.Comma(int64(s.OptStartSeq))))
}

if s.OptStartTime != nil {
parts = append(parts, fmt.Sprintf("Start Time: %v", s.OptStartTime))
}
if s.FilterSubject != "" {
parts = append(parts, fmt.Sprintf("Filter: %s", s.FilterSubject))
}
if s.SubjectTransformDest != "" {
if s.FilterSubject == "" {
parts = append(parts, fmt.Sprintf("Filter: %s", ">"))
}
parts = append(parts, fmt.Sprintf("Transform: %s", s.SubjectTransformDest))
}
if s.External != nil {
if s.External.ApiPrefix != "" {
parts = append(parts, fmt.Sprintf("API Prefix: %s", s.External.ApiPrefix))
Expand Down Expand Up @@ -1815,12 +1821,11 @@ func (c *streamCmd) showStreamInfo(info *api.StreamInfo) {
showSource := func(s *api.StreamSourceInfo) {
cols.AddRow("Stream Name", s.Name)
if s.SubjectTransformDest != "" {
if s.FilterSubject == "" {
cols.AddRow("Subject Filter",">")
} else {
cols.AddRow("Subject Filter",s.FilterSubject)
var filter = ">"
if s.FilterSubject != "" {
filter = s.FilterSubject
}
cols.AddRow("Subject Transform", s.SubjectTransformDest)
cols.AddRowf("Subject Transform", "%s to %s",filter,s.SubjectTransformDest)
} else {
cols.AddRowIfNotEmpty("Subject Filter",s.FilterSubject)
}
Expand Down

0 comments on commit a0178a4

Please sign in to comment.