From 90f9ced74688cc8ecbad61655876fd0326fd080f Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sat, 23 Mar 2019 18:04:08 +0100 Subject: [PATCH] add __repr__ --- dotdrop/action.py | 6 ++++++ dotdrop/dotfile.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/dotdrop/action.py b/dotdrop/action.py index 42d964c..2d9e6f9 100644 --- a/dotdrop/action.py +++ b/dotdrop/action.py @@ -27,6 +27,9 @@ class Cmd: def __str__(self): return 'key:{} -> \"{}\"'.format(self.key, self.action) + def __repr__(self): + return 'cmd({})'.format(self.__str__()) + def __eq__(self, other): return self.__dict__ == other.__dict__ @@ -51,6 +54,9 @@ class Action(Cmd): out = '{}: \"{}\" with args: {}' return out.format(self.key, self.action, self.args) + def __repr__(self): + return 'action({})'.format(self.__str__()) + def execute(self): """execute the action in the shell""" ret = 1 diff --git a/dotdrop/dotfile.py b/dotdrop/dotfile.py index 2b3b090..178d363 100644 --- a/dotdrop/dotfile.py +++ b/dotdrop/dotfile.py @@ -41,6 +41,9 @@ class Dotfile: msg = 'key:\"{}\", src:\"{}\", dst:\"{}\", link:\"{}\"' return msg.format(self.key, self.src, self.dst, self.link.name.lower()) + def __repr__(self): + return 'dotfile({})'.format(self.__str__()) + def __eq__(self, other): return self.__dict__ == other.__dict__