refactor: derive enum values from man page #4

Merged
barrettruth merged 2 commits from refactor/derive-enums-from-man into main 2026-02-23 04:39:25 +00:00
barrettruth commented 2026-02-23 04:35:05 +00:00

Problem

static_enums was a manually maintained table of ~40 keywords with
hardcoded valid values. This could go stale when OpenSSH adds, removes,
or changes config options across versions.

Solution

Parse enum values directly from the ssh_config man page at runtime
using two extraction strategies:

  • Definitive list sentences matching patterns like "The argument
    must be X, Y, or Z" and "The possible values are: X, Y, and Z"
  • Fallback extraction from scattered "set to X" / "The default is X"
    patterns for keywords without a single summary sentence

Also fixes keyword detection to handle digits in names (ForwardX11,
ForwardX11Trusted) and inline definitions (Tunnel, SetEnv).

Covers 36/41 old hardcoded keywords and discovers 4 new ones (IPQoS,
SyslogFacility, ObscureKeystrokeTiming, ControlPersist). The 5
missing keywords are yes/no booleans whose man page descriptions don't
explicitly enumerate their values.

## Problem `static_enums` was a manually maintained table of ~40 keywords with hardcoded valid values. This could go stale when OpenSSH adds, removes, or changes config options across versions. ## Solution Parse enum values directly from the `ssh_config` man page at runtime using two extraction strategies: - **Definitive list sentences** matching patterns like "The argument must be X, Y, or Z" and "The possible values are: X, Y, and Z" - **Fallback extraction** from scattered "set to X" / "The default is X" patterns for keywords without a single summary sentence Also fixes keyword detection to handle digits in names (`ForwardX11`, `ForwardX11Trusted`) and inline definitions (`Tunnel`, `SetEnv`). Covers 36/41 old hardcoded keywords and discovers 4 new ones (`IPQoS`, `SyslogFacility`, `ObscureKeystrokeTiming`, `ControlPersist`). The 5 missing keywords are yes/no booleans whose man page descriptions don't explicitly enumerate their values.
Sign in to join this conversation.
No description provided.