function wgctl::help() { cat </dev/null || printf "\n wgctl — WireGuard Management\n") Usage: wgctl [options] Client Commands: add, new Add a new client remove, rm Remove a client rename, mv Rename a client list, ls List all clients inspect Show detailed client info config Show client config qr Show QR code for a client Access Control: block, ban Block a client entirely unblock, unban Restore client access rule Manage firewall rules (list, show, add, assign...) Organization: group Manage peer groups (list, show, block, watch...) Monitoring: watch Live monitor of WireGuard activity logs Show activity and firewall logs audit Verify firewall rules are correctly applied fw Inspect firewall rules Service: service Manage WireGuard service (start/stop/restart/status) restart Restart WireGuard shell Start interactive wgctl shell Development: test Run the wgctl test suite Common examples: wgctl add --name nuno --type phone wgctl add --name visitor --type guest --subtype phone --group family wgctl list --blocked wgctl list --group family wgctl block --name phone-nuno wgctl inspect --name phone-nuno wgctl rule assign --name admin --peer laptop-nuno wgctl group block --name family wgctl logs --follow wgctl audit Run 'wgctl --help' for command-specific help. EOF } function cmd::logs::help() { cat < Filter by client name --type Filter by device type --limit Max results per source (default: 50) --fw Show only firewall drops --wg Show only WireGuard events --follow, -f Follow logs in real time Options for remove: --name Remove entries for specific peer --all Remove all log entries --fw Remove only firewall events --wg Remove only WireGuard events --before Remove entries older than N days --force Skip confirmation Examples: wgctl logs wgctl logs --name phone-nuno wgctl logs --fw --limit 100 wgctl logs --follow wgctl logs remove --name phone-nuno wgctl logs remove --all --force wgctl logs remove --before 7 wgctl logs remove --fw --before 1 EOF } function cmd::rule::help() { cat < [options] Manage firewall rules for peers. Subcommands: list, ls List all rules show Show rule details inspect Show full inheritance tree add, new, create Create a new rule update, edit Update a rule and re-apply to all peers remove, rm, del Remove a rule assign Assign a rule to a peer unassign Remove rule from a peer migrate Apply default rules to all unassigned peers reapply Re-apply a rule to all assigned peers Options for list: --base Show base rules section --no-base Hide base rules section (default shows them) --group Filter by group name --tree Show full inheritance tree inline Options for add/update: --name Rule name --desc Human readable description --group Display group (e.g. vm-rules, user-rules) --extends Inherit from base rules (add only) --add-extends Add base rules (update only) --remove-extends Remove base rules (update only) --allow-ip Allow IP or subnet (repeatable) --allow-port Allow specific port (repeatable) --block-ip Block IP or subnet (repeatable) --block-port Block specific port (repeatable) --dns-redirect Force DNS through Pi-hole --remove-allow-ip Remove allow IP entry --remove-allow-port Remove allow port entry --remove-block-ip Remove block IP entry --remove-block-port Remove block port entry Options for inspect: --name Rule name --peers Show assigned peers --resolved Show resolved/merged rule entries Options for assign/unassign: --name Rule name --peer Peer name --type Peer device type (optional) Examples: wgctl rule list wgctl rule list --base wgctl rule list --group vm-rules wgctl rule list --tree wgctl rule show --name guest wgctl rule inspect --name moonlight-02 wgctl rule inspect --name moonlight-02 --resolved --peers wgctl rule add --name dev-01 --desc "Dev VM" --group vm-rules --extends no-lan wgctl rule update --name dev-01 --add-extends no-nginx wgctl rule update --name dev-01 --remove-extends no-nginx wgctl rule update --name dev-01 --group infra-rules wgctl rule assign --name dev-01 --peer laptop-nuno wgctl rule unassign --peer laptop-nuno EOF } function cmd::inspect::help() { cat < [--type ] wgctl inspect Show detailed information for a single client. Options: --name Client name --type Device type (optional, combines with --name) --config Show raw client config --qr Show QR code Examples: wgctl inspect --name phone-nuno wgctl inspect --name nuno --type phone wgctl inspect --name phone-nuno --config wgctl inspect --name phone-nuno --qr EOF } function cmd::group::help() { cat < [options] Manage peer groups. Subcommands: list, ls List all groups show Show group details and members add, new, create Create a new group remove, rm, del Remove a group definition rename Rename a group peer add Add a peer to a group peer remove, peer rm Remove a peer from a group rm-peers Remove all peers from WireGuard server block Block all peers in group unblock Unblock all peers in group rule assign Assign a rule to all peers in group audit Audit all peers in group logs Show logs for all peers in group watch Live monitor for all peers in group Options: --name Group name --desc Group description --peer Peer name --type Peer device type (for peer resolution) --rule Rule name (for rule assign) --new-name New name (for rename) --force Skip confirmation prompts Examples: wgctl group add --name family --desc "Family devices" wgctl group peer add --name family --peer phone-nuno wgctl group block --name family wgctl group rule assign --name family --rule user wgctl group audit --name family EOF } function cmd::audit::help() { cat < Audit specific peer only --type Audit peers of specific type only Examples: wgctl audit wgctl audit --peer phone-nuno wgctl audit --fix EOF } function cmd::fw::help() { cat < Filter by peer name --rule Filter by rule name (shows all peers with that rule) --no-nflog Hide NFLOG rules --no-accept Hide ACCEPT rules --no-drop Hide DROP rules Examples: wgctl fw list wgctl fw list --peer phone-nuno wgctl fw list --rule guest wgctl fw list --no-nflog wgctl fw nat wgctl fw count wgctl fw flush-nat --subnet 10.1.103.0/24 EOF } function cmd::watch::help() { cat < Filter by device type --name Filter by client name --peers Filter by comma-separated peer names (used by group watch) --allowed Show only allowed client handshakes --restricted Show only restricted client events --blocked Show only blocked client attempts Examples: wgctl watch wgctl watch --blocked wgctl watch --allowed wgctl watch --type phone wgctl watch --name phone-nuno EOF }