diff options
Diffstat (limited to 'opnk.py')
-rwxr-xr-x | opnk.py | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -48,16 +48,16 @@ else: # -S : do not wrap long lines. Wrapping is done by offpunk, longlines # are there on purpose (surch in asciiart) #--incsearch : incremental search starting rev581 -if less_version >= 581: - less_base = "less --incsearch --save-marks -~ -XRfMWiS" -elif less_version >= 572: - less_base = "less --save-marks -XRfMWiS" -else: - less_base = "less -XRfMWiS" -_DEFAULT_LESS = less_base + " \"+''\" %s" -_DEFAULT_CAT = less_base + " -EF %s" - def less_cmd(file, histfile=None,cat=False,grep=None): + less_prompt = "page %%d/%%D- lines %%lb/%%L - %%Pb\%%" + if less_version >= 581: + less_base = "less --incsearch --save-marks -~ -XRfWiS -P \"%s\""%less_prompt + elif less_version >= 572: + less_base = "less --save-marks -XRfMWiS" + else: + less_base = "less -XRfMWiS" + _DEFAULT_LESS = less_base + " \"+''\" %s" + _DEFAULT_CAT = less_base + " -EF %s" if histfile: env = {"LESSHISTFILE": histfile} else: @@ -280,12 +280,18 @@ def main(): opnk will fallback to opening the file with xdg-open. If given an URL as input \ instead of a path, opnk will rely on netcache to get the networked content." parser = argparse.ArgumentParser(prog="opnk",description=descri) + parser.add_argument("--mode", metavar="MODE", + help="Which mode should be used to render: normal (default), full or source.\ + With HTML, the normal mode try to extract the article.") parser.add_argument("content",metavar="INPUT", nargs="*", default=sys.stdin, help="Path to the file or URL to open") + parser.add_argument("--cache-validity",type=int, default=0, + help="maximum age, in second, of the cached version before \ + redownloading a new version") args = parser.parse_args() cache = opencache() for f in args.content: - cache.opnk(f) + cache.opnk(f,mode=args.mode,validity=args.cache_validity) if __name__ == "__main__": main() |