[master] 64cb7b678 Generate the varnishstat(1) key bindings section
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Dec 9 08:42:08 UTC 2019
commit 64cb7b678f20626cd991a720df2878fbc5e7e7d6
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Dec 9 09:34:46 2019 +0100
Generate the varnishstat(1) key bindings section
It should currently result in 1:1 RST code, and might be output slightly
differently to accomodate a help screen, without changing the semantic
of the RST code.
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 0ab37c1ac..6906499e5 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -257,6 +257,18 @@ usage(int status)
exit(status);
}
+static int
+key_bindings(void)
+{
+
+#define BINDING_KEY(chr, name, next) \
+ printf("<%s>" next, name);
+#define BINDING(name, desc) \
+ printf("\n%s\n\n", desc);
+#include "varnishstat_bindings.h"
+ return (0);
+}
+
int
main(int argc, char * const *argv)
{
@@ -267,6 +279,9 @@ main(int argc, char * const *argv)
int has_f = 0;
struct vsc *vsc;
+ if (argc == 2 && !strcmp(argv[1], "--bindings"))
+ exit(key_bindings());
+
vut = VUT_InitProg(argc, argv, &vopt_spec);
AN(vut);
vd = VSM_New();
diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am
index 27997013d..41305b4a2 100644
--- a/doc/sphinx/Makefile.am
+++ b/doc/sphinx/Makefile.am
@@ -187,8 +187,12 @@ include/varnishstat_options.rst: $(top_builddir)/bin/varnishstat/varnishstat
include/varnishstat_synopsis.rst: $(top_builddir)/bin/varnishstat/varnishstat
$(top_builddir)/bin/varnishstat/varnishstat --synopsis > ${@}_
mv ${@}_ ${@}
+include/varnishstat_bindings.rst: $(top_builddir)/bin/varnishstat/varnishstat
+ $(top_builddir)/bin/varnishstat/varnishstat --bindings > ${@}_
+ mv ${@}_ ${@}
BUILT_SOURCES += include/varnishstat_options.rst \
- include/varnishstat_synopsis.rst
+ include/varnishstat_synopsis.rst \
+ include/varnishstat_bindings.rst
include/vsl-tags.rst: $(top_builddir)/lib/libvarnishapi/vsl2rst
$(top_builddir)/lib/libvarnishapi/vsl2rst > ${@}_
diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst
index d8a7e106b..26d1b9836 100644
--- a/doc/sphinx/reference/varnishstat.rst
+++ b/doc/sphinx/reference/varnishstat.rst
@@ -71,54 +71,7 @@ Avg_1000
Key bindings
------------
-The following keys control the interactive display:
-
-<UP> or <k>
- Navigate the counter list one line up.
-
-<DOWN> or <j>
- Navigate the counter list one line down.
-
-<PAGEUP> or <b> or <CTRL-b>
- Navigate the counter list one page up.
-
-<PAGEDOWN> or <SPACE> or <CTRL-f>
- Navigate the counter list one page down.
-
-<HOME> or <g>
- Navigate the counter list to the top.
-
-<END> or <G>
- Navigate the counter list to the bottom.
-
-<d>
- Toggle between showing and hiding unseen counters. Unseen
- counters are those that has been zero for the entire runtime
- of varnishstat. Defaults to hide unseen counters.
-
-<e>
- Toggle scaling of values.
-
-<v>
- Increase verbosity. Defaults to only showing informational
- counters.
-
-<V>
- Decrease verbosity. Defaults to only showing informational
- counters.
-
-<q>
- Quit.
-
-<CTRL+T>
- Sample now.
-
-<+>
- Increase refresh interval.
-
-<->
- Decrease refresh interval.
-
+.. include:: ../include/varnishstat_bindings.rst
OUTPUTS
=======
More information about the varnish-commit
mailing list