Add heading file argument to generator script
This commit is contained in:
parent
299b680748
commit
3691f75f81
@ -1,3 +1,5 @@
|
||||
- 0.0.22
|
||||
* Add man page generator script
|
||||
- 0.0.21
|
||||
* Log rpc reply before json parse
|
||||
- 0.0.20
|
||||
|
@ -193,7 +193,7 @@ class DocGenerator:
|
||||
self.docs['feeprice'] = o
|
||||
|
||||
o = DocEntry('--fee-limit')
|
||||
o.set_groff('Set the limit of execution units for the transaction. If used with \\fB-s\fP this may incur actual network token cost. If \\fB--fee-price\\fP is not explicitly set, the price \\fImay\\fP be retrieved from the network, and multiplied with this value to define the cost.')
|
||||
o.set_groff('Set the limit of execution units for the transaction. If used with \\fB-s\\fP this may incur actual network token cost. If \\fB--fee-price\\fP is not explicitly set, the price \\fImay\\fP be retrieved from the network, and multiplied with this value to define the cost.')
|
||||
self.docs['feelimit'] = o
|
||||
|
||||
# TODO: this manipulation should be DRYd
|
||||
|
@ -1,8 +1,42 @@
|
||||
import os
|
||||
import sys
|
||||
from hexathon import strip_0x
|
||||
from chainlib.cli.man import DocGenerator
|
||||
import argparse
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
b = bytes.fromhex(strip_0x(sys.argv[1]))
|
||||
from hexathon import strip_0x, add_0x
|
||||
|
||||
from chainlib.cli.man import DocGenerator
|
||||
from chainlib.cli.base import argflag_std_base
|
||||
|
||||
argparser = argparse.ArgumentParser()
|
||||
argparser.add_argument('-b', default=add_0x(hex(argflag_std_base)), help='argument flag bitmask')
|
||||
argparser.add_argument('-n', help='tool name to use for man filename')
|
||||
argparser.add_argument('-d', default='.', help='output directory')
|
||||
argparser.add_argument('header_file', help='groff file containing heading, synopsis and description')
|
||||
args = argparser.parse_args(sys.argv[1:])
|
||||
|
||||
#b = bytes.fromhex(strip_0x(sys.argv[1]))
|
||||
b = bytes.fromhex(strip_0x(args.b))
|
||||
g = DocGenerator(int.from_bytes(b, byteorder='little'))
|
||||
g.process()
|
||||
print(g)
|
||||
|
||||
f = open(args.header_file)
|
||||
head = f.read()
|
||||
f.close()
|
||||
|
||||
toolname = args.n
|
||||
if toolname == None:
|
||||
parts = os.path.splitext(os.path.basename(args.header_file))
|
||||
toolname = parts[0]
|
||||
|
||||
(fd, fp) = tempfile.mkstemp()
|
||||
f = os.fdopen(fd, 'w')
|
||||
f.write(head)
|
||||
f.write(str(g))
|
||||
f.close()
|
||||
|
||||
dest = os.path.join(args.d, toolname + '.1')
|
||||
shutil.copyfile(fp, dest)
|
||||
|
||||
os.unlink(fp)
|
||||
|
Loading…
Reference in New Issue
Block a user