blob: 0a3e540589215e041851abfc14413a39588fb6fd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
use lib::relative 'lib';
use Emacs;
use FindBin;
use Path::Tiny;
use IPC::Run3;
use Getopt::Long qw/ GetOptions /;
use Term::ANSIColor qw/ :pushpop colored color /;
local $SIG{__WARN__} = sub { print colored( $_[0], 'yellow' ); };
my %options = ();
GetOptions(
\%options,
qw{ verbose debug }
) or die "Error in command line arguments\n";
my %dispatch = (
"sync emacs" => sub { $options{config} = 1; Emacs::sync(\%options); },
"sync emacs irclogs" => sub { $options{irclogs} = 1; Emacs::sync(\%options); },
"sync emacs authinfo" => sub { $options{authinfo} = 1; Emacs::sync(\%options); },
);
if ( $dispatch{ "@ARGV" } ) {
$dispatch{ "@ARGV" }->();
} else {
my $file = path($FindBin::RealBin . "/share/theo");
my @insults = split/\n%\n/, $file->slurp;
print LOCALCOLOR RED "[ERR] " if $options{verbose};
say LOCALCOLOR YELLOW $insults[ rand @insults ];
}
|