Gitlab Community Edition Instance

Commit b52eff36 authored by mhellka's avatar mhellka
Browse files

Changed 'ls' to use localized times

parent c454c08a
......@@ -17,11 +17,12 @@ def register(subparsers):
help="Change what is printed per file. provide either a python format string, "
help="Change what is printed per file. Provide either a python format string, "
"or a csv with field names. Available fields: "
"name, id, type, size, created, modified, md5, sha1, sha256, meta[...]\n"
" (default: name)",
......@@ -64,9 +65,9 @@ def ls(ctx, args):
if args.exclude:
opts.setdefault("exclude_glob", []).append(args.exclude)
fmt = args.format
fmt = (
fmt.replace("\\t", "\t")
.replace("\\t", "\t")
.replace("\\0", "\0")
.replace("\\n", "\n")
.replace("\\\\", "\\")
......@@ -97,9 +98,10 @@ def file2str(fmt, file):
if "{hsize" in fmt:
attrs["hsize"] = hbytes(attrs["size"])
if "{created" in fmt:
attrs["created"] = iso8601.parse_date(attrs["created"])
attrs["created"] = iso8601.parse_date(attrs["created"]).astimezone().replace(
microsecond=0, tzinfo=None)
if "{modified" in fmt:
attrs["modified"] = iso8601.parse_date(attrs["modified"])
attrs["modified"] = iso8601.parse_date(attrs["modified"]).astimezone().replace(microsecond=0, tzinfo=None)
if "{meta" in fmt:
meta = defaultdict(lambda: "-")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment