Skip to content

Commit 9f41d3b

Browse files
committed
Add 'tailon --help-usage' to README
1 parent 4992174 commit 9f41d3b

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ frontend-watch:
2121
build-ct-image:
2222
podman build -t gvalkov/tailon .
2323

24-
README.md: main.go
24+
README.md:
2525
go build
26-
ed $@ <<< $$'/BEGIN HELP/+2,/END HELP/-2d\n/BEGIN HELP/+1r !./tailon --help 2>&1\n,w'
26+
ed $@ <<< $$'/BEGIN HELP_USAGE/+2,/END HELP_USAGE/-2d\n/BEGIN HELP_USAGE/+1r !./tailon --help 2>&1\n,w'
27+
ed $@ <<< $$'/BEGIN HELP_CONFIG/+2,/END HELP_CONFIG/-2d\n/BEGIN HELP_CONFIG/+1r !./tailon --help-config 2>&1\n,w'
2728
sed -i 's/[ \t]*$$//' $@
2829

2930
tests/.venv:
@@ -34,5 +35,5 @@ tests/requirements.txt: tests/requirements.in
3435
pip-compile $< > $@
3536

3637

37-
.PHONY: dev test frontend frontend-watch build-ct-image
38+
.PHONY: dev test frontend frontend-watch build-ct-image README.md
3839
.ONESHELL:

README.md

+59-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ server-side functionality is summarized entirely in its help message:
5151

5252
[//]: # (run "make README.md" to update the next section with the output of tailon --help)
5353

54-
[//]: # (BEGIN HELP)
54+
[//]: # (BEGIN HELP_USAGE)
5555
```
5656
Usage: tailon -c <config file>
5757
Usage: tailon [options] <filespec> [<filespec> ...]
@@ -98,7 +98,63 @@ Example usage:
9898
9999
See "--help-config" for configuration file usage.
100100
```
101-
[//]: # (END HELP)
101+
[//]: # (END HELP_USAGE)
102+
103+
[//]: # (BEGIN HELP_CONFIG)
104+
```
105+
The following options can be set through the config file:
106+
107+
# The <title> element of the of the webapp.
108+
title = "Tailon file viewer"
109+
110+
# The root of the web application.
111+
relative-root = "/"
112+
113+
# The addresses to listen on. Can be an address:port combination or an unix socket.
114+
listen-addr = [":8080"]
115+
116+
# Allow downloading of known files (i.e those matched by a filespec).
117+
allow-download = true
118+
119+
# Commands that will appear in the UI.
120+
allow-commands = ["tail", "grep", "sed", "awk"]
121+
122+
# A table of commands that the backend can execute. This is best illustrated by
123+
# the default configuration listed below.
124+
[commands]
125+
126+
# File, glob and dir filespecs are similar in principle to their
127+
# command-line counterparts.
128+
129+
At startup tailon loads the following default configuration:
130+
131+
title = "Tailon file viewer"
132+
relative-root = "/"
133+
listen-addr = [":8080"]
134+
allow-download = true
135+
allow-commands = ["tail", "grep", "sed", "awk"]
136+
137+
[commands]
138+
139+
[commands.tail]
140+
action = ["tail", "-n", "$lines", "-F", "$path"]
141+
142+
[commands.grep]
143+
stdin = "tail"
144+
action = ["grep", "--text", "--line-buffered", "--color=never", "-e", "$script"]
145+
default = ".*"
146+
147+
[commands.sed]
148+
stdin = "tail"
149+
action = ["sed", "-u", "-e", "$script"]
150+
default = "s/.*/&/"
151+
152+
[commands.awk]
153+
stdin = "tail"
154+
action = ["awk", "--sandbox", "$script"]
155+
default = "{print $0; fflush()}"
156+
```
157+
[//]: # (END HELP_CONFIG)
102158

103159
## Security
104160

@@ -140,7 +196,7 @@ go build -tags dev
140196
```
141197

142198
This will ensure that the `tailon` binary is reading assets from the
143-
`frontend/dist` directory instead of from `frontend/assets_vfsdata.go`.
199+
`frontend/dist` directory instead of from `frontend/assets_vfsdata.go`.
144200
To compile the web assets, use `make all` in `frontend`.
145201

146202
The `make watch` goal can be used to continuously update the bundles as you

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The following options can be set through the config file:
8181
# File, glob and dir filespecs are similar in principle to their
8282
# command-line counterparts.
8383
84-
At startup tailon loads its default config file. The contents of that file are:
84+
At startup tailon loads the following default configuration:
8585
`
8686

8787
const defaultTomlConfig = `

0 commit comments

Comments
 (0)