Skip to content

Commit

Permalink
[Added] account and export description/link to export selection
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Hanel <mh@synadia.com>
  • Loading branch information
matthiashanel committed Dec 7, 2020
1 parent 6a90bb2 commit eb3d5a6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions cmd/importcollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ func (aes AccountExportChoices) String() []string {
func (aec *AccountExportChoice) String() string {
// label
if aec.Selection == nil {
return fmt.Sprintf("%s:", aec.Name)
footer := ""
if aec.AccountExport.Description != "" {
footer = fmt.Sprintf("%s", aec.AccountExport.Description)
}
if aec.AccountExport.InfoURL != "" {
footer = fmt.Sprintf("%s\n Link: %s", footer, aec.AccountExport.InfoURL)
}
return fmt.Sprintf("%s: %s", aec.Name, footer)
}
// an actual export
k := "->"
Expand All @@ -76,11 +83,19 @@ func (aec *AccountExportChoice) String() string {
p = "[!]"
}

footer := ""
if aec.Selection.Description != "" {
footer = fmt.Sprintf("\n Description: %s", aec.Selection.Description)
}
if aec.Selection.InfoURL != "" {
footer = fmt.Sprintf("%s\n Link: %s", footer, aec.Selection.InfoURL)
}

if aec.Selection.Name == string(aec.Selection.Subject) {
return fmt.Sprintf(" %s %s %s", k, aec.Selection.Subject, p)
return fmt.Sprintf(" %s %s %s%s", k, aec.Selection.Subject, p, footer)
}

return fmt.Sprintf(" %s [%s] %s %s", k, aec.Selection.Name, aec.Selection.Subject, p)
return fmt.Sprintf(" %s [%s] %s %s%s", k, aec.Selection.Name, aec.Selection.Subject, p, footer)
}

type AccountImport struct {
Expand Down

0 comments on commit eb3d5a6

Please sign in to comment.