Function utils::trackeddeck_detail::suggestKey

Function Documentation

inline auto utils::trackeddeck_detail::suggestKey(const std::string &unusedPath, const std::set<std::string> &wanted) -> std::string

Suggest which key the user probably meant for an unused one.

Two rules, in order. First, a wanted path with the same last segment as the unused key: the key is right but in the wrong section, e.g. output.n_trial when n_trial is a top-level key. Second, a wanted path whose last segment is within two edits of the unused key’s, and at least four characters long, so that short names do not match everything: a misspelling, e.g. stars.v_vcirt for stars.v_vcrit. The closest such path wins.

Parameters:
  • unusedPath – Canonical path of the key that was never read

  • wanted – Paths the code looked for but did not find

Returns:

A phrase such as “did you mean ‘n_trial’?”, or empty if nothing plausible