MCPcopy
hub / github.com/nosarthur/gita / truncate

Method truncate

gita/info.py:33–43  ·  view source on GitHub ↗
(self, field: str, message: str)

Source from the content-addressed store, hash-verified

31 self.widths[e] = int(width)
32
33 def truncate(self, field: str, message: str):
34 # 0 means no width limit applied
35 if not self.widths.get(field):
36 return message
37
38 length = 3 if self.widths[field] < 3 else self.widths[field]
39 return (
40 message[: length - 3] + "..."
41 if len(message) > length
42 else message.ljust(length)
43 )
44
45
46class Color(Enum):

Callers 5

get_pathFunction · 0.80
get_commit_msgFunction · 0.80
get_commit_timeFunction · 0.80
get_repo_statusFunction · 0.80
get_repo_branchFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected