Migrate some stuff away from print_format.

This commit is contained in:
Sadie Powell 2021-01-27 16:47:08 +00:00
parent f6b861f12d
commit 859a79923a
8 changed files with 21 additions and 21 deletions

10
configure vendored
View File

@ -143,7 +143,7 @@ our $interactive = !(
);
my %version = get_version $opt_distribution_label;
print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
say console_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>";
my %config;
if ($interactive) {
@ -433,7 +433,7 @@ $config{DISTRIBUTION} = $opt_distribution_label if $opt_distribution_label;
write_configure_cache %config;
parse_templates \%config, \%compiler, \%version;
print_format <<"EOM";
print console_format <<"EOM";
Configuration is complete! You have chosen to build with the following settings:
@ -453,7 +453,7 @@ my @makeargs;
push @makeargs, "-C${\abs2rel $RealDir}" unless getcwd eq $RealDir;
push @makeargs, "-j${\(get_cpu_count() + 1)}";
print_format <<"EOM";
say console_format <<"EOM";
<|GREEN Paths:|>
<|GREEN Base:|> $config{BASE_DIR}
@ -596,7 +596,7 @@ sub enable_extras(@) {
if (-e $modulepath) {
print_error "unable to symlink <|GREEN ${\abs2rel $modulepath}|> to <|GREEN ${\abs2rel $extrapath}|>: the target exists and is not a symlink.";
} else {
print_format "Enabling the <|GREEN $shortname|> module ...\n";
say console_format "Enabling the <|GREEN $shortname|> module ...";
symlink $extrapath, $modulepath or print_error "unable to symlink <|GREEN ${\abs2rel $modulepath}|> to <|GREEN ${\abs2rel $extrapath}|>: $!";
}
}
@ -619,7 +619,7 @@ sub disable_extras(@) {
} elsif ((-e $modulepath && !-e $extrapath) || !-l $modulepath) {
print_error "the <|GREEN $shortname|> module is not an extra module!";
} else {
print_format "Disabling the <|GREEN $shortname|> module ...\n";
say console_format "Disabling the <|GREEN $shortname|> module ...";
unlink $modulepath or print_error "unable to unlink <|GREEN $extrapath|>: $!";
}
}

View File

@ -45,7 +45,7 @@ sub create_directory($$) {
}
sub execute(@) {
print_format "<|BOLD \$|> @_\n";
say console_format "<|BOLD \$|> @_";
return system @_;
}

View File

@ -76,17 +76,17 @@ sub print_format($;$) {
}
sub print_error {
print_format "<|RED Error:|> ", *STDERR;
print STDERR console_format "<|RED Error:|> ";
for my $line (@_) {
print_format "$line\n", *STDERR;
say STDERR console_format $line;
}
exit 1;
}
sub print_warning {
print_format "<|YELLOW Warning:|> ", *STDERR;
print STDERR console_format "<|YELLOW Warning:|> ";
for my $line (@_) {
print_format "$line\n", *STDERR;
print STDERR console_format $line;
}
}
@ -119,8 +119,8 @@ sub prompt_dir($$$;$) {
sub prompt_string($$$) {
my ($interactive, $question, $default) = @_;
return $default unless $interactive;
print_format "$question\n";
print_format "[<|GREEN $default|>] => ";
say console_format $question;
say console_format "[<|GREEN $default|>] => ";
chomp(my $answer = <STDIN>);
say '';
return $answer ? $answer : $default;

View File

@ -57,9 +57,9 @@ exit 1;
sub message($$$) {
my ($type, $file, $command) = @_;
if ($ENV{INSPIRCD_VERBOSE}) {
print "$command\n";
say $command;
} else {
print_format "\t<|GREEN $type:|>\t\t$file\n";
say console_format "\t<|GREEN $type:|>\t\t$file";
}
}

View File

@ -30,7 +30,7 @@ use make::console;
use make::directive;
if (scalar @ARGV < 2) {
print_format "<|GREEN Usage:|> $0 <<|UNDERLINE FILE|>> [<|UNDERLINE DIRECTIVES...|>]\n", *STDERR;
say STDERR console_format "<|GREEN Usage:|> $0 <<|UNDERLINE FILE|>> [<|UNDERLINE DIRECTIVES...|>]";
exit 1
}
@ -40,7 +40,7 @@ print_error "<|GREEN $file|> does not exist and/or is not a file!" unless -f $fi
for my $directive (@ARGV) {
my $value = get_directive $file, $directive, '';
if (-t STDOUT) {
print_format "<|GREEN $directive|>: $value\n";
say console_format "<|GREEN $directive|>: $value";
} else {
say $value;
}

View File

@ -35,7 +35,7 @@ use make::common;
use make::console;
unless (scalar @ARGV) {
print_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>\n", *STDERR;
say STDERR console_format "<|GREEN Usage:|> $0 <<|UNDERLINE DOCS-SITE|>>";
exit 1;
}

View File

@ -50,7 +50,7 @@ for my $path (@paths) {
next if $path =~ /\/vendor\//;
if (system "git ls-files --error-unmatch -- $path 1>/dev/null 2>/dev/null") {
print_format "Skipping <|YELLOW $path|> as it has not been committed.\n" if defined $ENV{MKHEADERS_VERBOSE};
say STDERR console_format "Skipping <|YELLOW $path|> as it has not been committed." if defined $ENV{MKHEADERS_VERBOSE};
next;
}
@ -68,7 +68,7 @@ for my $path (@paths) {
close $fh;
if (defined $copyright) {
print_format "Updating copyright headers in <|GREEN $path|>.\n" if defined $ENV{MKHEADERS_VERBOSE};
say console_format "Updating copyright headers in <|GREEN $path|>." if defined $ENV{MKHEADERS_VERBOSE};
my (%author, %authors);
my $ignored_args = join ' ', map { "--ignore-rev $_" } @ignored_revisions;
for my $line (split /\n+/, `git blame $ignored_args --incremental -w HEAD -- $path`) {
@ -135,7 +135,7 @@ for my $path (@paths) {
close $fh;
push @updated, $path;
} else {
print_format "Skipping <|YELLOW $path|> as it contains no copyright headers.\n" if defined $ENV{MKHEADERS_VERBOSE};
say STDERR console_format "Skipping <|YELLOW $path|> as it contains no copyright headers." if defined $ENV{MKHEADERS_VERBOSE};
}
}

2
vendor/update vendored
View File

@ -43,7 +43,7 @@ my ($data, $error) = from_toml $contents;
print_error "unable to parse $config: $!" if $error;
while (my ($name, $info) = each %{$data}) {
print_format "Updating <|GREEN $name|> ...\n";
say console_format "Updating <|GREEN $name|> ...";
my $unpackdir = File::Temp->newdir;
my $vendordir = catdir $RealDir, $name;