bcicen / slackcat

CLI utility to post files and command output to slack
http://slackcat.chat
MIT License
1.22k stars 57 forks source link

Add streaming #9

Closed bcicen closed 8 years ago

bcicen commented 8 years ago

Add streaming option to continuously flush piped input to Slack. Something like: tail -f /var/log/messages | slackcat --stream --channel my-channel

ytjohn commented 8 years ago

Using the other slackcat, I do this:

tail -F logfile | grep --line-buffered -v '^\s*$' | slackcat

https://github.com/skattyadz/slackcat/blob/master/slackcat.go#L192-L201

    scanner := bufio.NewScanner(os.Stdin)
    for scanner.Scan() {
        msg := SlackMsg{
            Channel:   cfg.Channel,
            Username:  cfg.Username,
            Parse:     "full",
            Text:      scanner.Text(),
            IconEmoji: cfg.IconEmoji,
        }
bcicen commented 8 years ago

Continuous streaming of input as preformatted messages has been added in the latest release