CheckManpage.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import print_function
  4. import sys
  5. import re
  6. import os
  7. import argparse
  8. from os.path import *
  9. from subprocess import Popen, PIPE
  10. from CheckOptions import CheckOptions
  11. class CheckManpage (CheckOptions):
  12. def __init__(self, args):
  13. CheckOptions.__init__(self, args)
  14. self.option_pattern = '\.It Fl \\\\-([-A-Za-z]+)'
  15. self.function_pattern = '\.It Fn ([-A-Za-z_]+)'
  16. self.source_file = join(self.source, 'doc', 'ledger.1')
  17. self.source_type = 'manpage'
  18. if __name__ == "__main__":
  19. def getargs():
  20. parser = argparse.ArgumentParser(prog='CheckManpage',
  21. description='Check that ledger options are documented in the manpage')
  22. parser.add_argument('-l', '--ledger',
  23. dest='ledger',
  24. type=str,
  25. action='store',
  26. required=True,
  27. help='the path to the ledger executable to test with')
  28. parser.add_argument('-s', '--source',
  29. dest='source',
  30. type=str,
  31. action='store',
  32. required=True,
  33. help='the path to the top level ledger source directory')
  34. return parser.parse_args()
  35. args = getargs()
  36. script = CheckManpage(args)
  37. status = script.main()
  38. sys.exit(status)