Colorized the metadata result.
This commit is contained in:
parent
73f046c44d
commit
8474203c32
1 changed files with 7 additions and 4 deletions
11
tools.py
11
tools.py
|
|
@ -165,8 +165,9 @@ def md5(path):
|
||||||
def metadata(path):
|
def metadata(path):
|
||||||
|
|
||||||
def _detail(value, unit):
|
def _detail(value, unit):
|
||||||
return (" (%s)" % value if unit is None else " (%s %s)" %
|
result = (" (%s)" % value if unit is None else " (%s %s)" %
|
||||||
(value, unit))
|
(value, unit))
|
||||||
|
return termstr.TermStr(result).fg_color(termstr.Color.grey_100)
|
||||||
is_symlink = "yes" if os.path.islink(path) else "no"
|
is_symlink = "yes" if os.path.islink(path) else "no"
|
||||||
stat_result = os.stat(path)
|
stat_result = os.stat(path)
|
||||||
permissions = stat.filemode(stat_result.st_mode)
|
permissions = stat.filemode(stat_result.st_mode)
|
||||||
|
|
@ -206,8 +207,10 @@ def metadata(path):
|
||||||
text.append("\n")
|
text.append("\n")
|
||||||
else:
|
else:
|
||||||
name, value = line
|
name, value = line
|
||||||
text.append("%-15s %s\n" % (name + ":", "".join(value)))
|
name = termstr.TermStr(name + ":").fg_color(
|
||||||
return (Status.normal, fill3.Text("".join(text)))
|
termstr.Color.light_blue).ljust(16)
|
||||||
|
text.append(name + fill3.join("", value) + "\n")
|
||||||
|
return (Status.normal, fill3.Text(fill3.join("", text)))
|
||||||
metadata.dependencies = {"file", "coreutils"}
|
metadata.dependencies = {"file", "coreutils"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue