]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Purge all remaining uses of print_format.
authorSadie Powell <sadie@witchery.services>
Fri, 29 Jan 2021 13:39:13 +0000 (13:39 +0000)
committerSadie Powell <sadie@witchery.services>
Fri, 29 Jan 2021 13:39:13 +0000 (13:39 +0000)
make/configure.pm
make/console.pm
make/directive.pm

index dcdcd0acada48ace09c2a3a2edcd5fe3b7d833d4..86ce8d0a17d4439b126fe9674c2066b0ba69ba75 100644 (file)
@@ -199,8 +199,8 @@ sub cmd_update {
 sub run_test($$;$) {
        my ($what, $result, $adjective) = @_;
        $adjective //= 'available';
-       print_format "Checking whether <|GREEN $what|> is $adjective ... ";
-       print_format $result ? "<|GREEN yes|>\n" : "<|RED no|>\n";
+       print console_format "Checking whether <|GREEN $what|> is $adjective ... ";
+       say console_format $result ? "<|GREEN yes|>" : "<|RED no|>";
        return $result;
 }
 
@@ -237,11 +237,11 @@ sub module_shrink($) {
 
 sub write_configure_cache(%) {
        unless (-e CONFIGURE_DIRECTORY) {
-               print_format "Creating <|GREEN ${\abs2rel CONFIGURE_DIRECTORY, CONFIGURE_ROOT}|> ...\n";
+               say console_format "Creating <|GREEN ${\abs2rel CONFIGURE_DIRECTORY, CONFIGURE_ROOT}|> ...";
                create_directory CONFIGURE_DIRECTORY, 0750 or print_error "unable to create ${\CONFIGURE_DIRECTORY}: $!";
        }
 
-       print_format "Writing <|GREEN ${\abs2rel CONFIGURE_CACHE_FILE, CONFIGURE_ROOT}|> ...\n";
+       say console_format "Writing <|GREEN ${\abs2rel CONFIGURE_CACHE_FILE, CONFIGURE_ROOT}|> ...";
        my %config = @_;
        write_config_file CONFIGURE_CACHE_FILE, %config;
 }
@@ -277,7 +277,7 @@ sub parse_templates($$$) {
 
        # Iterate through files in make/template.
        foreach my $template (<${\CONFIGURE_ROOT}/make/template/*>) {
-               print_format "Parsing <|GREEN ${\abs2rel $template, CONFIGURE_ROOT}|> ...\n";
+               say console_format "Parsing <|GREEN ${\abs2rel $template, CONFIGURE_ROOT}|> ...";
                open(my $fh, $template) or print_error "unable to read $template: $!";
                my (@lines, $mode, @platforms, @targets);
 
@@ -336,12 +336,12 @@ sub parse_templates($$$) {
                                # Create the directory if it doesn't already exist.
                                my $directory = dirname $target;
                                unless (-e $directory) {
-                                       print_format "Creating <|GREEN ${\abs2rel $directory, CONFIGURE_ROOT}|> ...\n";
+                                       say console_format "Creating <|GREEN ${\abs2rel $directory, CONFIGURE_ROOT}|> ...";
                                        create_directory $directory, 0750 or print_error "unable to create $directory: $!";
                                };
 
                                # Write the template file.
-                               print_format "Writing <|GREEN ${\abs2rel $target, CONFIGURE_ROOT}|> ...\n";
+                               say console_format "Writing <|GREEN ${\abs2rel $target, CONFIGURE_ROOT}|> ...";
                                open(my $fh, '>', $target) or print_error "unable to write $target: $!";
                                foreach (@lines) {
                                        say $fh $_;
index 50df77ea50e741b095625696fe0a63e83e8fe374..cd2a780e7b88164d33068947f2a5473fa05fa3bd 100644 (file)
@@ -31,7 +31,6 @@ use File::Spec::Functions qw(rel2abs);
 our @EXPORT = qw(command
                  execute_command
                  console_format
-                 print_format
                  print_error
                  print_warning
                  prompt_bool
@@ -69,12 +68,6 @@ sub console_format($) {
        return $message;
 }
 
-sub print_format($;$) {
-       my $message = shift;
-       my $stream = shift // *STDOUT;
-       print { $stream } console_format $message;
-}
-
 sub print_error {
        print STDERR console_format "<|RED Error:|> ";
        for my $line (@_) {
@@ -120,7 +113,7 @@ sub prompt_string($$$) {
        my ($interactive, $question, $default) = @_;
        return $default unless $interactive;
        say console_format $question;
-       say console_format "[<|GREEN $default|>] => ";
+       print console_format "[<|GREEN $default|>] => ";
        chomp(my $answer = <STDIN>);
        say '';
        return $answer ? $answer : $default;
@@ -143,13 +136,14 @@ sub command_alias($$) {
 sub execute_command(@) {
        my $command = defined $_[0] ? lc shift : 'help';
        if ($command eq 'help') {
-               print_format "<|GREEN Usage:|> $0 <<|UNDERLINE COMMAND|>> [<|UNDERLINE OPTIONS...|>]\n\n";
-               print_format "<|GREEN Commands:|>\n";
+               say console_format "<|GREEN Usage:|> $0 <<|UNDERLINE COMMAND|>> [<|UNDERLINE OPTIONS...|>]";
+               say '';
+               say console_format "<|GREEN Commands:|>";
                for my $key (sort keys %commands) {
                        next unless defined $commands{$key}->description;
                        my $name = sprintf "%-15s", $key;
                        my $description = $commands{$key}->description;
-                       print_format "  <|BOLD $name|> # $description\n";
+                       say console_format "  <|BOLD $name|> # $description";
                }
                exit 0;
        } elsif (!$commands{$command}) {
index 25e61160e26386bf28bd599aaf045726fdaf5366..cd1aff426416a20f1a2b7a0b78ec43c1768402af 100644 (file)
@@ -145,7 +145,7 @@ sub __function_execute {
        # Try to execute the command...
        chomp(my $result = `$command ${\DIRECTIVE_ERROR_PIPE}`);
        unless ($?) {
-               print_format "Execution of `<|GREEN $command|>` succeeded: <|BOLD $result|>\n";
+               say console_format "Execution of `<|GREEN $command|>` succeeded: <|BOLD $result|>";
                return $result;
        }
 
@@ -153,14 +153,14 @@ sub __function_execute {
        if (defined $environment && $environment ne '') {
                $environment = __environment 'INSPIRCD_', $environment;
                if (defined $ENV{$environment}) {
-                       print_format "Execution of `<|GREEN $command|>` failed; using the environment: <|BOLD $ENV{$environment}|>\n";
+                       say console_format "Execution of `<|GREEN $command|>` failed; using the environment: <|BOLD $ENV{$environment}|>";
                        return $ENV{$environment};
                }
        }
 
        # If all else fails then look for the defaults..
        if (defined $defaults) {
-               print_format "Execution of `<|GREEN $command|>` failed; using the defaults: <|BOLD $defaults|>\n";
+               say console_format "Execution of `<|GREEN $command|>` failed; using the defaults: <|BOLD $defaults|>";
                return $defaults;
        }
 
@@ -174,20 +174,20 @@ sub __function_find_compiler_flags {
        # Try to look up the compiler flags with pkg-config...
        chomp(my $flags = `pkg-config --cflags $name ${\DIRECTIVE_ERROR_PIPE}`);
        unless ($?) {
-               print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>\n";
+               say console_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>";
                return $flags;
        }
 
        # If looking up with pkg-config fails then check the environment...
        my $key = __environment 'INSPIRCD_CXXFLAGS_', $name;
        if (defined $ENV{$key}) {
-               print_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               say console_format "Found the <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
                return $ENV{$key};
        }
 
        # If all else fails then look for the defaults..
        if (defined $defaults) {
-               print_format "Using the default <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>\n";
+               say console_format "Using the default <|GREEN $name|> compiler flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>";
                return $defaults;
        }
 
@@ -201,20 +201,20 @@ sub __function_find_linker_flags {
        # Try to look up the linker flags with pkg-config...
        chomp(my $flags = `pkg-config --libs $name ${\DIRECTIVE_ERROR_PIPE}`);
        unless ($?) {
-               print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>\n";
+               say console_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using pkg-config: <|BOLD $flags|>";
                return $flags;
        }
 
        # If looking up with pkg-config fails then check the environment...
        my $key = __environment 'INSPIRCD_CXXFLAGS_', $name;
        if (defined $ENV{$key}) {
-               print_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               say console_format "Found the <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
                return $ENV{$key};
        }
 
        # If all else fails then look for the defaults..
        if (defined $defaults) {
-               print_format "Using the default <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>\n";
+               say console_format "Using the default <|GREEN $name|> linker flags for <|GREEN ${\module_shrink $file}|>: <|BOLD $defaults|>";
                return $defaults;
        }
 
@@ -287,13 +287,13 @@ sub __function_vendor_directory {
        # Try to look the directory up in the environment...
        my $key = __environment 'INSPIRCD_VENDOR_', $name;
        if (defined $ENV{$key}) {
-               print_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>\n";
+               say console_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|> using the environment: <|BOLD $ENV{$key}|>";
                return $ENV{$key};
        }
 
        my $directory = catdir(VENDOR_DIRECTORY, $name);
        if (-d $directory) {
-               print_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|>: <|BOLD $directory|>\n";
+               say console_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\module_shrink $file}|>: <|BOLD $directory|>";
                return $directory;
        }