Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CriticalCellStyle = excelize.Style{ Fill: excelize.Fill{ Type: "pattern", Color: []string{"DC143C"}, Pattern: 1, }, Font: &excelize.Font{ Color: "FFFFFF", }, } WarningCellStyle = excelize.Style{ Fill: excelize.Fill{ Type: "pattern", Color: []string{"FFD700"}, Pattern: 1, }, Font: &excelize.Font{ Color: "000000", }, } OKCellStyle = excelize.Style{ Fill: excelize.Fill{ Type: "pattern", Color: []string{"32cd32"}, Pattern: 1, }, Font: &excelize.Font{ Color: "FFFFFF", }, } HeadingCellStyle = excelize.Style{ Font: &excelize.Font{ Bold: true, }, } )
Hardwired cell defaults
View Source
var DV2EMAILCmd = &cobra.Command{ Use: "dv2email", Short: "Email a Dataview following Geneos Action/Effect conventions", Long: DV2EMAILCmdDescription, SilenceUsage: true, CompletionOptions: cobra.CompletionOptions{ DisableDefaultCmd: true, }, Version: cordial.VERSION, DisableAutoGenTag: true, DisableSuggestions: true, DisableFlagsInUseLine: true, PersistentPreRun: func(cmd *cobra.Command, args []string) { initConfig() }, RunE: func(cmd *cobra.Command, _ []string) (err error) { gw, err := dialGateway(cf) if err != nil { log.Fatal().Err(err).Msg("") } em := email.NewEmailConfig(cf, toArg, ccArg, bccArg) data, err := fetchDataviews(cmd, gw, em.GetString("_firstcolumn"), em.GetString("__headlines"), em.GetString("__rows"), em.GetString("__columns"), em.GetString("__roworder"), ) if err != nil { log.Error().Err(err).Msg("") return } switch cf.GetString("email.split") { case "entity": entities := map[string][]*commands.Dataview{} for _, d := range data.Dataviews { if len(entities[d.XPath.Entity.Name]) == 0 { entities[d.XPath.Entity.Name] = []*commands.Dataview{} } entities[d.XPath.Entity.Name] = append(entities[d.XPath.Entity.Name], d) } for _, e := range entities { many := DV2EMailData{ Dataviews: e, Env: data.Env, } if err = sendEmail(cf, em, many, inlineCSS); err != nil { log.Fatal().Err(err).Msg("") } } case "dataview": for _, d := range data.Dataviews { one := DV2EMailData{ Dataviews: []*commands.Dataview{d}, Env: data.Env, } if err = sendEmail(cf, em, one, inlineCSS); err != nil { log.Fatal().Err(err).Msg("") } } default: if err = sendEmail(cf, em, data, inlineCSS); err != nil { log.Fatal().Err(err).Msg("sending failed") } } return }, }
DV2EMAILCmd represents the base command when called without any subcommands
View Source
var DV2EMAILCmdDescription string
Functions ¶
Types ¶
type DV2EMailData ¶ added in v1.11.0
type DV2EMailData struct { // Dataviews is a slice of each Dataview's data, including Columns // and Rows which are ordered names for the columns and rows // respectively, suitable for range loops. See // https://pkg.go.dev/github.com/itrs-group/cordial/pkg/commands#Dataview // for details Dataviews []*commands.Dataview // Env is a map of environment variable, names to values Env map[string]string }
type NatsortStringSlice ¶ added in v1.11.2
type NatsortStringSlice []string
NatsortStringSlice attaches the methods of Interface to []string, sorting in increasing order using natural order.
func (NatsortStringSlice) Len ¶ added in v1.11.2
func (p NatsortStringSlice) Len() int
func (NatsortStringSlice) Less ¶ added in v1.11.2
func (p NatsortStringSlice) Less(i, j int) bool
func (NatsortStringSlice) Swap ¶ added in v1.11.2
func (p NatsortStringSlice) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.