Skip to content

Placeholders -- Display revolved value #312

@llaville

Description

@llaville

While I'm implementing my plugin https://github.com/llaville/captainhook-bin-plugin to a real project, I run in trouble with context, and I take a time before to understand what was wrong.

I think it will be a good improvement if placeholders (that are already printed) could also display resolved value.

Here is an example of what I will have :

Image

Note

The new resolved part of Placeholder printed line (in VERBOSE mode)

Here is a suggest of patch :

diff --git a/src/Runner/Action/Cli/Command/Formatter.php b/src/Runner/Action/Cli/Command/Formatter.php
index c4f46a9..7b1f309 100644
--- a/src/Runner/Action/Cli/Command/Formatter.php
+++ b/src/Runner/Action/Cli/Command/Formatter.php
@@ -174,13 +174,16 @@ class Formatter
                 return '';
             }

+            $processor = $this->createPlaceholder($placeholder);
+            $resolved = $processor->replacement($options);
+
             $this->io->write(
-                '  <fg=cyan>Placeholder: ' . $placeholder . '</>' .  $this->optionsAsString($options),
+                '  <fg=cyan>Placeholder: ' . $placeholder . '</>' .  $this->optionsAsString($options) .
+                ' <fg=cyan>resolved: </>' . $resolved,
                 true,
                 IO::VERBOSE
             );

-            $processor = $this->createPlaceholder($placeholder);
             $this->cache($rawPlaceholder, $processor->replacement($options));
         }
         return $this->cached($rawPlaceholder);

@sebastianfeldmann WDYT ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions