|
|
|
|
@ -13,8 +13,8 @@ output=''
|
|
|
|
|
|
|
|
|
|
# Setup/parse arguments |
|
|
|
|
parser = argparse.ArgumentParser(description='Output lines based on complex criteria') |
|
|
|
|
parser.add_argument('start',help='Regex to start buffering on') |
|
|
|
|
parser.add_argument('end',help='Regex to close a stanza and output buffer') |
|
|
|
|
parser.add_argument('open',help='Regex to open the stanza start buffering on') |
|
|
|
|
parser.add_argument('close',help='Regex to close a stanza and output buffer') |
|
|
|
|
parser.add_argument('-1','--oneline', help='Output each stanza on one line',action='store_true',dest='oneline', default=False) |
|
|
|
|
parser.add_argument('-d','--debug', help='Debug',action='store_true', default=False) |
|
|
|
|
parser.add_argument('-m','--match',help='Regex to indicate a valid/desired stanza to output',default='.', action='store',metavar="/r/") |
|
|
|
|
@ -25,9 +25,9 @@ args = parser.parse_known_args(sys.argv[1:])
|
|
|
|
|
# Move namespace into separate var |
|
|
|
|
cmd=args[0] |
|
|
|
|
# Set up positional args |
|
|
|
|
start=cmd.start |
|
|
|
|
start=cmd.open |
|
|
|
|
match=cmd.match |
|
|
|
|
end=cmd.end |
|
|
|
|
end=cmd.close |
|
|
|
|
|
|
|
|
|
def debug(line): |
|
|
|
|
if cmd.debug: |
|
|
|
|
|