#!/usr/bin/env python from jjcli import * from xmldt import XmlDt, toxml c=clfilter(opt="Hdo:") ## option values in c.opt dictionary pattern, where = c.args html= "-H" in c.opt or match(r'.*\.html?$', where) class proc (XmlDt): def __pcdata__(s,t): if search( pattern, t): print("→ ", [(x.q, x.v) if x.v else x.q for x in s._path]) return t if match(r'https?://', where): proc( url= where, html=html) else: proc( filename= where, html=html)