Add -w/--write-config to bootstrap a fully-populated config file

Writes every supported config option explicitly -- the six
unshare-* bools defaulted via value_or(true), log-level captured
from the actually active spdlog level (so an explicit --log-level
passed alongside -w is persisted too) -- creating the file and its
parent directory if missing, and prints its full path. Existing
values (including volumes) are preserved untouched.

Also fixes a stale README row left over from unplugging the
namespace probe out of -t/--test.
This commit is contained in:
2026-08-30 09:44:03 +00:00
parent bcae8bbcd4
commit ace71e0474
5 changed files with 81 additions and 6 deletions
+10 -1
View File
@@ -94,7 +94,8 @@ slocker-lite -V|--version
| `--delete-volume-full <name>` | Like `--delete-volume`, but also recursively deletes the volume's host directory. |
| `--list-processes` | List running `--run` sessions found by their pid files under `$XDG_STATE_HOME/slocker-lite/run/`, with their pid, container name, and status (`running` or `exited`). |
| `--clean-processes` | Remove stale pid files (see `--list-processes`) left behind by sessions that are no longer running. |
| `-t, --test` | Print which `bwrap --unshare-xxx` namespaces the running kernel supports. |
| `-w, --write-config` | Write a complete config file (creating it, and its parent directory, if missing), filling in every option's current or default value. Useful to bootstrap one for hand-editing. Prints the config file's full path. |
| `-t, --test` | Run the (currently empty) self-test placeholder. |
| `--log-level <level>` | Set log verbosity (`trace`, `debug`, `info`, `warn`, `error`, `critical`, `off`). |
| `-h, --help` | Print usage and exit. |
| `-V, --version` | Print version information and exit. |
@@ -194,6 +195,14 @@ managed by `-v/--volume` (see above) rather than hand-edited — it's what
is fine either way (nothing is overridden, and one gets created the first
time `-v/--volume` is used).
Run `-w/--write-config` to bootstrap a config file: it writes out every
supported option explicitly (filling in the current or default value for
anything not already set — so the block above is exactly what a fresh `-w`
produces), creating the file and its parent directory if they don't exist
yet, and prints the file's full path. Combine it with other flags to seed
specific values, e.g. `slocker-lite --log-level debug -w` writes
`log-level: debug`.
## How it works
Image layers are imported into `containers-storage` (parent-chained) and the