#!/usr/bin/env ruby # frozen_string_literal: true require 'rubygems' require 'gli' require_relative '../lib/slack_messaging' include GLI::App program_desc 'Slack Messaging' version SlackMessaging::VERSION wrap_help_text :verbatim flag %i[c config], desc: 'Slack Messaging config file path', default_value: SlackMessaging::DefaultPaths.config program_long_desc " DOCUMENTATION For documentation and help in setting up your configuration files, see Slack Messaging's GitHub repo: https://github.com/emmahsax/slack_messaging " pre do |global, _command, _options, _args| SlackMessaging::Config.load(global[:config]) true end desc 'Prints a variety of messages to Slack' command 'send' do |c| c.desc "The service ('slack' or 'discord') that you wish to notify - if none is given, Slack Messaging will " \ 'notify each service present in the config file' c.flag %i[s service] c.action do |_global_options, options, args| SlackMessaging::Send.execute(args, options) end end desc 'Sets up a Slack Messaging config file at ~/.slack_messaging.yml' skips_pre command 'setup' do |c| c.action do SlackMessaging::Setup.execute end end exit run(ARGV)