Merge branch 'master' of git.hjp.at:hjp/kitsune

This commit is contained in:
Peter J. Holzer 2025-02-23 23:00:53 +01:00
commit 93cf7b35b9
1 changed files with 13 additions and 1 deletions

14
kitsune
View File

@ -94,7 +94,13 @@ def watch(args):
if lines[-1] == "":
lines.pop()
for ln in lines:
print(f"{f.path:{filename_length}}", format_ts(f.last_ts), dead, ln)
s = ""
if args.print_filename:
s += f"{f.path:{filename_length}} "
if args.print_timestamp:
s += format_ts(f.last_ts) + " "
s += dead + " " + ln
print(s)
else:
try:
stf = os.stat(f.path)
@ -115,6 +121,12 @@ if __name__ == "__main__":
ap.add_argument("--match-filename",
help="follow only matching files in directories",
metavar="GLOB-PATTERN")
ap.add_argument("--no-filename", "--no-print-filename", action="store_false",
dest="print_filename",
help="don't print filename in each line")
ap.add_argument("--no-timestamp", "--no-print-timestamp", action="store_false",
dest="print_timestamp",
help="don't print timestamp in each line")
ap.add_argument("files", nargs="*", default=["."],
metavar="file")
args = ap.parse_args()