mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-08 11:24:16 +00:00
add __repr__
This commit is contained in:
@@ -27,6 +27,9 @@ class Cmd:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'key:{} -> \"{}\"'.format(self.key, self.action)
|
return 'key:{} -> \"{}\"'.format(self.key, self.action)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'cmd({})'.format(self.__str__())
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.__dict__ == other.__dict__
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
@@ -51,6 +54,9 @@ class Action(Cmd):
|
|||||||
out = '{}: \"{}\" with args: {}'
|
out = '{}: \"{}\" with args: {}'
|
||||||
return out.format(self.key, self.action, self.args)
|
return out.format(self.key, self.action, self.args)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'action({})'.format(self.__str__())
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
"""execute the action in the shell"""
|
"""execute the action in the shell"""
|
||||||
ret = 1
|
ret = 1
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ class Dotfile:
|
|||||||
msg = 'key:\"{}\", src:\"{}\", dst:\"{}\", link:\"{}\"'
|
msg = 'key:\"{}\", src:\"{}\", dst:\"{}\", link:\"{}\"'
|
||||||
return msg.format(self.key, self.src, self.dst, self.link.name.lower())
|
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):
|
def __eq__(self, other):
|
||||||
return self.__dict__ == other.__dict__
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user