Update and improve documentation

This commit is contained in:
Peter J. Holzer 2022-03-19 10:57:32 +01:00 committed by Peter J. Holzer
parent 2cd059908c
commit 411939468b
2 changed files with 15 additions and 8 deletions

View File

@ -12,7 +12,7 @@ Usage
----- -----
``` ```
kitsune [--match-filename pattern] [paths] kitsune [--match-filename pattern] [--start] [paths]
``` ```
There are zero or more paths. If 0 paths are provided, "." (the current There are zero or more paths. If 0 paths are provided, "." (the current
@ -26,10 +26,13 @@ any new file matching pattern will also added.
pattern is a standard shell glob pattern (as implemented by Pythons pattern is a standard shell glob pattern (as implemented by Pythons
fnmatch module). fnmatch module).
The output contains of the file name, a timestamp and the contents of By default, kitsune will print only content added after program start.
each line for each line in the watched files. It pads the file names to The `--start` option will dump each file from the beginning.
the length of the longest file name seen so far, so the three columns
should line up nicely. The output contains of the file name, a timestamp, a deletion indicator
and the contents of each line for each line in the watched files. It
pads the file names to the length of the longest file name seen so far,
so the three columns should line up nicely.
Name Name
---- ----

10
kitsune
View File

@ -88,9 +88,13 @@ def watch(args):
if __name__ == "__main__": if __name__ == "__main__":
ap = argparse.ArgumentParser() ap = argparse.ArgumentParser()
ap.add_argument("--start", action='store_true') ap.add_argument("--start", action='store_true',
ap.add_argument("--match-filename") help="dump existing files from the start")
ap.add_argument("files", nargs="*", default=["."]) ap.add_argument("--match-filename",
help="follow only matching files in directories",
metavar="GLOB-PATTERN")
ap.add_argument("files", nargs="*", default=["."],
metavar="file")
args = ap.parse_args() args = ap.parse_args()
watch(args) watch(args)