Skip to content

Commit

Permalink
include/nutconf.hpp: document how to discover keywords for UpsConfigu…
Browse files Browse the repository at this point in the history
…ration class [networkupstools#2294]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Apr 27, 2024
1 parent 42e51c6 commit 28fb457
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/nutconf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,35 @@ class UpsdConfigParser : public NutConfigParser
/** UPS configuration */
class UpsConfiguration : public GenericConfiguration
{
/* Note: key words for ups.conf are well collected from sources
* by augeas lens preparation scripts. Maintainers of this class
* can consume that information like this to see key words in
* context of their use in sources and documentation (omit the
* `continue` in grep of `nutconf.hpp` to see details of ALL
* keywords and not just those not yet covered by this class
* (e.g. to verify handling as str/int/bool/flag... types):
:; ( cd scripts/augeas && python ./gen-nutupsconf-aug.py.in )
:; grep -E '[=|] "' scripts/augeas/nutupsconf.aug.in | awk '{print $NF}' | tr -d '"' \
| while read O ; do echo "=== $O :" ; \
grep -w '"'"$O"'"' ./include/nutconf.hpp && continue ; \
grep -A10 -w "$O" ./docs/man/*.txt || echo '!!! UNDOCUMENTED !!!' ; \
echo "-----"; grep -A10 -w '"'"$O"'"' ./drivers/*.{c,h} || echo '!!! NOT USED IN CODE !!!' ; \
echo "-----"; echo "" ; done | less
* Arrange found new keywords into two columns (first would be
* "C names" camel-cased and expanded as deemed fit) and generate
* lines for code blocks below as e.g.:
:; while read C O ; do \
printf '\tinline std::string get%-45sconst { return getStr(ups, "%s"); }\n' \
"$C"'(const std::string & ups)' "$O"; \
printf '\tinline void set%-75s{ setStr(ups, "%-22s val); }\n' \
"$C"'(const std::string & ups, const std::string & val)' "$O"'",' ; \
done < nutupsconf-newnames.bool | sort
*/

public:
/** Global configuration attributes getters and setters \{ */

Expand Down

0 comments on commit 28fb457

Please sign in to comment.