File: CheckManpage.py

package info (click to toggle)
ledger 3.1.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,464 kB
  • sloc: cpp: 37,495; python: 4,279; perl: 1,319; sh: 475; lisp: 436; makefile: 134; cs: 118; yacc: 103
file content (45 lines) | stat: -rwxr-xr-x 1,231 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function

import sys
import re
import os
import argparse

from os.path import *
from subprocess import Popen, PIPE

from CheckOptions import CheckOptions

class CheckManpage (CheckOptions):
  def __init__(self, args):
    CheckOptions.__init__(self, args)
    self.option_pattern = '\.It Fl \\\\-([-A-Za-z]+)'
    self.function_pattern = '\.It Fn ([-A-Za-z_]+)'
    self.source_file = join(self.source, 'doc', 'ledger.1')
    self.source_type = 'manpage'

if __name__ == "__main__":
  def getargs():
    parser = argparse.ArgumentParser(prog='CheckManpage',
            description='Check that ledger options are documented in the manpage')
    parser.add_argument('-l', '--ledger',
        dest='ledger',
        type=str,
        action='store',
        required=True,
        help='the path to the ledger executable to test with')
    parser.add_argument('-s', '--source',
        dest='source',
        type=str,
        action='store',
        required=True,
        help='the path to the top level ledger source directory')
    return parser.parse_args()

  args = getargs()
  script = CheckManpage(args)
  status = script.main()
  sys.exit(status)