summaryrefslogtreecommitdiffstats
path: root/bin/reply
blob: 8a6a4b57fbc49345cb6a2cde9fccd0d92580601a (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
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
use strict;
use warnings;
# PODNAME: reply

use File::HomeDir;
use File::Spec;

use Reply;

my $cfg = File::Spec->catfile(File::HomeDir->my_home, ".replyrc");

my %args = (config => $cfg);
if (!-e $cfg) {
    print("$cfg not found. Generating a default...\n");
    if (open my $fh, '>', $cfg) {
        my $contents = do {
            local $/;
            <DATA>
        };
        $contents =~ s/use 5.XXX/use $]/;
        print $fh $contents;
        close $fh;
    }
    else {
        warn "Couldn't write to $cfg";
        %args = ();
    }
}

Reply->new(%args)->run;

__DATA__
script_line1 = use strict
script_line2 = use warnings
script_line2 = use 5.XXX

[Interrupt]
[FancyPrompt]
[DataDumper]
[Colors]
[ReadLine]
[Hints]
[Packages]
[LexicalPersistence]