From 859a79923a1e9df7195e1320d66b61ee162f52cc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 27 Jan 2021 16:47:08 +0000 Subject: [PATCH] Migrate some stuff away from print_format. --- configure | 10 +++++----- make/common.pm | 2 +- make/console.pm | 12 ++++++------ make/unit-cc.pl | 4 ++-- tools/directive | 4 ++-- tools/mkdescriptions | 2 +- tools/mkheaders | 6 +++--- vendor/update | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 029d566af..5d4520f31 100755 --- a/configure +++ b/configure @@ -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|>: $!"; } } diff --git a/make/common.pm b/make/common.pm index 38b77e215..519e7fba8 100644 --- a/make/common.pm +++ b/make/common.pm @@ -45,7 +45,7 @@ sub create_directory($$) { } sub execute(@) { - print_format "<|BOLD \$|> @_\n"; + say console_format "<|BOLD \$|> @_"; return system @_; } diff --git a/make/console.pm b/make/console.pm index 278c97d0f..50df77ea5 100644 --- a/make/console.pm +++ b/make/console.pm @@ -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 = ); say ''; return $answer ? $answer : $default; diff --git a/make/unit-cc.pl b/make/unit-cc.pl index f8991cb67..f555c3812 100755 --- a/make/unit-cc.pl +++ b/make/unit-cc.pl @@ -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"; } } diff --git a/tools/directive b/tools/directive index 07d4b09e2..c743ed3e6 100755 --- a/tools/directive +++ b/tools/directive @@ -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; } diff --git a/tools/mkdescriptions b/tools/mkdescriptions index bb6f011d8..5145422c0 100755 --- a/tools/mkdescriptions +++ b/tools/mkdescriptions @@ -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; } diff --git a/tools/mkheaders b/tools/mkheaders index 0ca593584..f7b1247da 100755 --- a/tools/mkheaders +++ b/tools/mkheaders @@ -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}; } } diff --git a/vendor/update b/vendor/update index ca113ff29..3c04bc63a 100755 --- a/vendor/update +++ b/vendor/update @@ -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; -- 2.39.2