From c18ce501389d186cc9f134434d2bbd81bdf1b2b2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 2 Apr 2020 11:00:45 -0400 Subject: [PATCH] Integrate attributes into man pages --- confluent_client/addattribs.py | 21 +++++++++++++++++++ .../{nodeattrib.ronn => nodeattrib.ronn.tmpl} | 2 ++ ...pattrib.ronn => nodegroupattrib.ronn.tmpl} | 2 ++ confluent_client/makeman | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 confluent_client/addattribs.py rename confluent_client/doc/man/{nodeattrib.ronn => nodeattrib.ronn.tmpl} (99%) rename confluent_client/doc/man/{nodegroupattrib.ronn => nodegroupattrib.ronn.tmpl} (99%) diff --git a/confluent_client/addattribs.py b/confluent_client/addattribs.py new file mode 100644 index 00000000..bc1befe5 --- /dev/null +++ b/confluent_client/addattribs.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +import os +import sys +path = os.path.dirname(os.path.realpath(__file__)) +path = os.path.realpath(os.path.join(path, '..', 'confluent_server')) +print(repr(path)) +sys.path.append(path) + +import confluent.config.attributes as attr +import shutil + +shutil.copyfile('doc/man/nodeattrib.ronn.tmpl', 'doc/man/nodeattrib.ronn') +shutil.copyfile('doc/man/nodegroupattrib.ronn.tmpl', 'doc/man/nodegroupattrib.ronn') +with open('doc/man/nodeattrib.ronn', 'a') as outf: + for field in sorted(attr.node): + outf.write('\n* `{0}`:\n {1}\n'.format(field, attr.node[field]['description'])) +with open('doc/man/nodegroupattrib.ronn', 'a') as outf: + for field in sorted(attr.node): + outf.write('\n* `{0}`:\n {1}\n'.format(field, attr.node[field]['description'])) + + diff --git a/confluent_client/doc/man/nodeattrib.ronn b/confluent_client/doc/man/nodeattrib.ronn.tmpl similarity index 99% rename from confluent_client/doc/man/nodeattrib.ronn rename to confluent_client/doc/man/nodeattrib.ronn.tmpl index ca7b81e4..ee0de020 100644 --- a/confluent_client/doc/man/nodeattrib.ronn +++ b/confluent_client/doc/man/nodeattrib.ronn.tmpl @@ -100,3 +100,5 @@ See nodegroupattrib(8) command on how to manage attributes on a group level. ## SEE ALSO nodegroupattrib(8), nodeattribexpressions(5) + +## ATTRIBUTES diff --git a/confluent_client/doc/man/nodegroupattrib.ronn b/confluent_client/doc/man/nodegroupattrib.ronn.tmpl similarity index 99% rename from confluent_client/doc/man/nodegroupattrib.ronn rename to confluent_client/doc/man/nodegroupattrib.ronn.tmpl index 6a16ef93..36cf8103 100644 --- a/confluent_client/doc/man/nodegroupattrib.ronn +++ b/confluent_client/doc/man/nodegroupattrib.ronn.tmpl @@ -41,3 +41,5 @@ the attributes are set on the node versus a group to which a node belongs. ## SEE ALSO nodeattrib(8), nodeattribexpressions(5) + +## ATTRIBUTES diff --git a/confluent_client/makeman b/confluent_client/makeman index a5fb4405..a414dadc 100755 --- a/confluent_client/makeman +++ b/confluent_client/makeman @@ -1,4 +1,6 @@ #!/bin/sh +cd `dirname $0` +python3 addattribs.py || python2 addattribs.py cd `dirname $0`/doc/man mkdir -p ../../man/man1 mkdir -p ../../man/man5