morganestes
5/25/2017 - 7:14 PM

Wrapper to use slackcat to upload files to a default channel

Wrapper to use slackcat to upload files to a default channel

#!/usr/bin/env bash

# Uses http://slackcat.chat/ to upload a file to a Slack channel
function _slackit() {
  if [ $# -eq 0 ]; then
    echo 'No file provided.'
    echo 'Usage: slackit <filename> [channel]'
    return 0
  fi

  local filename
  local channel

  filename="$(basename ${1})"
  channel="${2:=general}" #sets default channel if one's not passed

  slackcat -c "${channel}" "${filename}"
}

alias slackit="_slackit"