pw_env_setup: Add repr methods to env Actions

Change-Id: I4342d3ec3675f733fc50c568c085d17006c7be78
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/42103
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: David Rogers <davidrogers@google.com>
diff --git a/pw_env_setup/py/pw_env_setup/environment.py b/pw_env_setup/py/pw_env_setup/environment.py
index 1a97c0a..cdadfad 100644
--- a/pw_env_setup/py/pw_env_setup/environment.py
+++ b/pw_env_setup/py/pw_env_setup/environment.py
@@ -124,6 +124,10 @@
         else:
             env.pop(self.name, None)
 
+    def __repr__(self):
+        return '{}({}, {})'.format(self.__class__.__name__, self.name,
+                                   self.value)
+
 
 class Set(_VariableAction):
     """Set a variable."""
@@ -202,6 +206,9 @@
     def accept(self, visitor):
         visitor.visit_echo(self)
 
+    def __repr__(self):
+        return 'Echo({}, newline={})'.format(self.value, self.newline)
+
 
 class Comment(_Action):
     """Add a comment to the init script."""
@@ -212,6 +219,9 @@
     def accept(self, visitor):
         visitor.visit_comment(self)
 
+    def __repr__(self):
+        return 'Comment({})'.format(self.value)
+
 
 class Command(_Action):
     """Run a command."""
@@ -225,6 +235,9 @@
     def accept(self, visitor):
         visitor.visit_command(self)
 
+    def __repr__(self):
+        return 'Command({})'.format(self.command)
+
 
 class Doctor(Command):
     def __init__(self, *args, **kwargs):
@@ -237,12 +250,18 @@
     def accept(self, visitor):
         visitor.visit_doctor(self)
 
+    def __repr__(self):
+        return 'Doctor()'
+
 
 class BlankLine(_Action):
     """Write a blank line to the init script."""
     def accept(self, visitor):
         visitor.visit_blank_line(self)
 
+    def __repr__(self):
+        return 'BlankLine()'
+
 
 class Function(_Action):
     def __init__(self, name, body, *args, **kwargs):
@@ -253,11 +272,17 @@
     def accept(self, visitor):
         visitor.visit_function(self)
 
+    def __repr__(self):
+        return 'Function({}, {})'.format(self.name, self.body)
+
 
 class Hash(_Action):
     def accept(self, visitor):
         visitor.visit_hash(self)
 
+    def __repr__(self):
+        return 'Hash()'
+
 
 class Join(object):  # pylint: disable=useless-object-inheritance
     def __init__(self, pathsep=os.pathsep):