Skip to content

Commit

Permalink
Add slack-notify program
Browse files Browse the repository at this point in the history
  • Loading branch information
robn committed Jul 15, 2019
1 parent 46a951c commit 49bba92
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- added a dumb program, slack-notify, to send things from the command line

0.001 2017-09-28 22:20:41+10:00 Australia/Melbourne
18 changes: 14 additions & 4 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
use strict;
use warnings;


use 5.010;

use ExtUtils::MakeMaker;

Expand All @@ -13,15 +13,22 @@ my %WriteMakefileArgs = (
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Slack-Notify",
"EXE_FILES" => [
"bin/slack-notify"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010",
"NAME" => "Slack::Notify",
"PREREQ_PM" => {
"Getopt::Long::Descriptive" => 0,
"HTTP::Tiny" => 0,
"JSON::MaybeXS" => 0,
"Moo" => 0,
"Type::Utils" => 0,
"Types::Standard" => 0,
"namespace::autoclean" => 0
"namespace::autoclean" => 0,
"strict" => 0,
"warnings" => 0
},
"VERSION" => "0.001",
"test" => {
Expand All @@ -31,12 +38,15 @@ my %WriteMakefileArgs = (


my %FallbackPrereqs = (
"Getopt::Long::Descriptive" => 0,
"HTTP::Tiny" => 0,
"JSON::MaybeXS" => 0,
"Moo" => 0,
"Type::Utils" => 0,
"Types::Standard" => 0,
"namespace::autoclean" => 0
"namespace::autoclean" => 0,
"strict" => 0,
"warnings" => 0
);


Expand Down
57 changes: 57 additions & 0 deletions bin/slack-notify
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env perl

use 5.010;
use warnings;
use strict;

use Getopt::Long::Descriptive;
use Slack::Notify;


my ($opt, $usage) = describe_options(
'%c %o <text>',
[ 'hook_url|u=s', 'URL of Slack incoming webhook to post to', { required => 1 } ],
[ 'help', 'print usage and exit', { shortcircuit => 1 } ],
);
my $text = join ' ', @ARGV;

print $usage->text and exit if $opt->help || !length($text);

Slack::Notify->new(hook_url => $opt->hook_url)->post(text => $text);

__END__
=pod
=encoding UTF-8
=head1 NAME
slack-nofity - Send Slack messages from the command line
=head1 SYNOPSIS
slack-notify --hook_url=https://hooks.slack.com/services/... something happened
=head1 DESCRIPTION
A very simple command-line program to send text into a Slack channel.
=head1 SEE ALSO
=over 4
=item *
L<Slack::Notify>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Rob N ★
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

0 comments on commit 49bba92

Please sign in to comment.