aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-05-12 21:02:59 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-05-12 21:02:59 +0000
commit9f8a0daa7aebd3d3673e26949b44864e4b3a450d (patch)
tree4450e812252a2579d2e92dd085c68625b2a3bb1b
parent557ff039d9c1018c7100062e587550a9509a2b6d (diff)
downloads6-frontend-9f8a0daa7aebd3d3673e26949b44864e4b3a450d.tar.gz
Add verbosity; update s6 version doc
-rw-r--r--doc/s6.html9
-rw-r--r--doc/s6_version.html86
-rw-r--r--src/s6-frontend/version_export.c8
3 files changed, 96 insertions, 7 deletions
diff --git a/doc/s6.html b/doc/s6.html
index 00976ff..a1f348f 100644
--- a/doc/s6.html
+++ b/doc/s6.html
@@ -89,10 +89,6 @@ reason, here you go.
<dd> Run the <a href="#help"><tt>s6 help</tt></a> command.
Any given command or subcommand is ignored. </dd>
- <dt> -V, --version </dt>
- <dd> Run the <a href="#version"><tt>s6 version</tt></a> command.
-Any given command or subcommand is ignored. </dd>
-
<dt> -s <em>scandir</em>, --scandir=<em>scandir</em> </dt>
<dd> Use <em>scandir</em> as scan directory (i.e. the directory where
<a href="//skarnet.org/software/s6/s6-svscan.html">s6-svscan</a> runs
@@ -151,11 +147,12 @@ and usage of the s6 command. It is not as detailed as this page.
<h3 id="version"> version </h3>
<p>
- <tt>s6 version</tt> prints the current version of s6-frontend, on one line.
+ <tt>s6 version</tt> prints information about the current version of
+s6-frontend and its configuration.
</p>
<p>
- No subcommands are defined.
+ The details are available <a href="s6_version.html">here</a>.
</p>
<h3 id="process"> process </h3>
diff --git a/doc/s6_version.html b/doc/s6_version.html
new file mode 100644
index 0000000..85b3d20
--- /dev/null
+++ b/doc/s6_version.html
@@ -0,0 +1,86 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="color-scheme" content="dark light" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>s6-frontend: the s6 version command</title>
+ <meta name="Description" content="s6-frontend: the s6 version command" />
+ <meta name="Keywords" content="s6 ecosystem supervision service manager user interface init skarnet.org skarnet software version configuration" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="s6.html">The s6 command</a><br />
+<a href="index.html">s6-frontend</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>s6 version</tt> command </h1>
+
+<p>
+ <tt>s6 version</tt> groups actions related to printing information about the
+current version and configuration of s6-frontend.
+</p>
+
+<h2 id="interface"> Interface </h2>
+
+<pre>
+ s6 version <em>subcommand</em> [ <em>subcommand_options...</em> ] [ <em>args...</em> ]
+</pre>
+
+<ul>
+ <li> <tt>s6 v</tt> is accepted as an alias for <tt>s6 version</tt>. </li>
+ <li> <tt>s6 version</tt> without a subcommand is equivalent to <tt>s6 version show</tt>. </li>
+</ul>
+
+<h2 id="subcommands"> Subcommands </h2>
+
+<h3 id="help"> help </h3>
+
+<p>
+ <tt>s6 process help</tt> prints a short help message summarizing the options
+and usage of the <tt>s6 process</tt> command. It is not as detailed as this page.
+</p>
+
+<h3 id="show"> show </h3>
+
+<h4> Interface </h4>
+
+<pre>
+ s6 version show
+</pre>
+
+<ul>
+ <li> <tt>s6 version show</tt> prints <tt>s6-frontend v</tt> followed by the
+current running version of s6-frontend, then a newline. </li>
+</ul>
+
+<h3 id="export"> export </h3>
+
+<h4> Interface </h4>
+
+<pre>
+ s6 version export [ -q ]
+</pre>
+
+<ul>
+ <li> <tt>s6 version export</tt> prints a series of <em>key=value</em> lines,
+representing the version and configuration data for the current running version
+of s6-frontend. </li>
+ <li> Keys are: <tt>version</tt>, then all the variables that are supported in
+the <a href="s6-frontend.conf.html">configuration file</a>. </li>
+</ul>
+
+<h4> Options </h4>
+
+<dl>
+<dt> <tt>-q</tt>, <tt>--quote</tt> </dt>
+<dd> Quote the printed paths. This is useful e.g. if the paths contain spaces
+and you're reading the output of <tt>s6 version export</tt> in a shell. </dd>
+</dl>
+
+</body>
+</html>
diff --git a/src/s6-frontend/version_export.c b/src/s6-frontend/version_export.c
index 14e0de3..b62b8ac 100644
--- a/src/s6-frontend/version_export.c
+++ b/src/s6-frontend/version_export.c
@@ -2,6 +2,7 @@
#include <unistd.h>
+#include <skalibs/types.h>
#include <skalibs/buffer.h>
#include <skalibs/gol.h>
#include <skalibs/stralloc.h>
@@ -50,6 +51,9 @@ void version_export (char const *const *argv)
stralloc sa = STRALLOC_ZERO ;
uint64_t wgolb = 0 ;
out_func_ref f = &print_unquoted ;
+ size_t len ;
+ char fmt[UINT_FMT] ;
+
argv += gol_argv(argv, rgolb, 1, 0, 0, &wgolb, 0) ;
if (wgolb & GOLB_QUOTE) f = &print_quoted ;
@@ -60,6 +64,8 @@ void version_export (char const *const *argv)
(*f)("bootdb", g->dirs.scan, &sa) ;
(*f)("stmpdir", g->dirs.stmp, &sa) ;
(*f)("storelist", g->dirs.stol, &sa) ;
- if (!buffer_flush(buffer_1)) dieout() ;
+ len = uint_fmt(fmt, g->verbosity) ; fmt[len++] = '\n' ;
+ if (!buffer_puts(buffer_1, "verbosity=")
+ || !buffer_putflush(buffer_1, fmt, len)) dieout() ;
_exit(0) ;
}