Skip to content

Commit 81bc6bc

Browse files
committed
test: add show_flag_test and document --show-keys in help
1 parent 7aac71d commit 81bc6bc

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: MIT
3+
# Small integration test: build `wg` and check that `wg show --help` mentions --show-keys
4+
set -euo pipefail
5+
6+
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
7+
cd "$REPO_ROOT/src"
8+
9+
echo "Building src/ (this may take a moment)..."
10+
make V=1 || { echo "Build failed"; exit 2; }
11+
12+
WG_BIN="$REPO_ROOT/src/wg"
13+
if [ ! -x "$WG_BIN" ]; then
14+
echo "wg binary not found at $WG_BIN" >&2
15+
exit 3
16+
fi
17+
18+
echo "Checking 'wg show --help' for --show-keys flag"
19+
HELP_OUT="$($WG_BIN show --help 2>&1 || true)"
20+
21+
if echo "$HELP_OUT" | grep -q -- "--show-keys"; then
22+
echo "OK: --show-keys documented in show help"
23+
exit 0
24+
else
25+
echo "FAIL: --show-keys not found in show help output:" >&2
26+
echo "$HELP_OUT" >&2
27+
exit 4
28+
fi

src/show.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ static const char *COMMAND_NAME;
207207
static void show_usage(void)
208208
{
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);
210+
fprintf(stderr, "Optional flags: --show-keys\n");
210211
}
211212

212213
static void pretty_print(struct wgdevice *device)

0 commit comments

Comments
 (0)