Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "slackstatus \"your message here\"", Short: "Post a formatted status message to Slack", Long: `Post a formatted status message to a Slack channel with a given username. An optional footer info can be provided. You can set one of the predifined colors DANGER, WARNING or GOOD or use any hex color value. You need to set up an incoming webhook for your Slack at https://my.slack.com/services/new/incoming-webhook/ first. `, Run: func(cmd *cobra.Command, args []string) { message := getPipedInput() if len(args) > 0 { message = args[0] } if len(message) == 0 { cmd.Help() log.Fatal("You need to provide a message as argument or pipe a message") } var slackmsg = slackstatus.Message{ WebhookURL: viper.GetString("webhook"), Username: viper.GetString("user"), Channel: viper.GetString("channel"), IconEmoji: viper.GetString("iconemoji"), Footer: viper.GetString("footer"), RetryRatelimited: viper.GetBool("retry"), RetryBackground: false, } if err := slackmsg.Send(message, viper.GetString("color")); err != nil { log.Fatal(err) } }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.