Skip to content

Commit 90e5357

Browse files
committed
docs/tests: document --show-keys usage; add smoke-test script
Signed-off-by: SupananWC <[email protected]>
1 parent 81bc6bc commit 90e5357

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

external-tests/show_flag_test.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Simple smoke test: build the `wg` binary and verify `--show-keys` appears
5+
# in the `wg show --help` output. This runs locally and is intentionally
6+
# lightweight (does not require creating kernel devices).
7+
8+
cd src
9+
echo "Building src/... (this may take a moment)"
10+
make V=1
11+
12+
echo "Checking help for --show-keys"
13+
if ./wg show --help 2>&1 | grep -q -- '--show-keys'; then
14+
echo "OK: --show-keys present in help"
15+
exit 0
16+
else
17+
echo "FAIL: --show-keys not found in help output"
18+
./wg show --help 2>&1 | sed -n '1,200p'
19+
exit 2
20+
fi

src/show.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ static void show_usage(void)
209209
fprintf(stderr, "Usage: %s %s { <interface> | all | interfaces } [public-key | private-key | listen-port | fwmark | peers | preshared-keys | endpoints | allowed-ips | latest-handshakes | transfer | persistent-keepalive | dump]\n", PROG_NAME, COMMAND_NAME);
210210
fprintf(stderr, "Optional flags: --show-keys\n");
211211
}
212-
212+
fprintf(stderr, "Usage: %s %s [--show-keys] { <interface> | all | interfaces } [public-key | private-key | listen-port | fwmark | peers | preshared-keys | endpoints | allowed-ips | latest-handshakes | transfer | persistent-keepalive | dump]\n", PROG_NAME, COMMAND_NAME);
213+
fprintf(stderr, "Options:\n --show-keys Reveal keys temporarily for debugging (respects WG_HIDE_KEYS=never)\n");
213214
static void pretty_print(struct wgdevice *device)
214215
{
215216
struct wgpeer *peer;

0 commit comments

Comments
 (0)