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
@ -26,10 +26,13 @@ any new file matching pattern will also added.
pattern is a standard shell glob pattern (as implemented by Pythons
fnmatch module).
The output contains of the file name, a timestamp 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.
By default, kitsune will print only content added after program start.
The `--start` option will dump each file from the beginning.
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
----

10
kitsune
View File

@ -88,9 +88,13 @@ def watch(args):
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("--start", action='store_true')
ap.add_argument("--match-filename")
ap.add_argument("files", nargs="*", default=["."])
ap.add_argument("--start", action='store_true',
help="dump existing files from the start")
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()
watch(args)