]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - tools/directive
Update copyright headers.
[user/henk/code/inspircd.git] / tools / directive
1 #!/usr/bin/env perl
2 #
3 # InspIRCd -- Internet Relay Chat Daemon
4 #
5 #   Copyright (C) 2020-2021 Sadie Powell <sadie@witchery.services>
6 #
7 # This file is part of InspIRCd.  InspIRCd is free software: you can
8 # redistribute it and/or modify it under the terms of the GNU General Public
9 # License as published by the Free Software Foundation, version 2.
10 #
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20
21 use v5.10.0;
22 use strict;
23 use warnings FATAL => qw(all);
24
25 use File::Basename qw(dirname);
26 use FindBin        qw($RealDir);
27
28 use lib dirname $RealDir;
29 use make::console;
30 use make::directive;
31
32 if (scalar @ARGV < 2) {
33         say STDERR console_format "<|GREEN Usage:|> $0 <<|UNDERLINE FILE|>> [<|UNDERLINE DIRECTIVES...|>]";
34         exit 1
35 }
36
37 my $file = shift;
38 print_error "<|GREEN $file|> does not exist and/or is not a file!" unless -f $file;
39
40 for my $directive (@ARGV) {
41         my $value = get_directive $file, $directive, '';
42         if (-t STDOUT) {
43                 say console_format "<|GREEN $directive|>: $value";
44         } else {
45                 say $value;
46         }
47 }