~lioploum/offpunk

2faf460f0ff25b38723168fedce89987a94c4611 — Ploum 3 months ago 6484cf3
close #39: implement --mode in opnk
4 files changed, 9 insertions(+), 1 deletions(-)

M CHANGELOG
M man/ansicat.1
M man/opnk.1
M opnk.py
M CHANGELOG => CHANGELOG +1 -0
@@ 12,6 12,7 @@
- offpunk: "gus" was broken, it is functionnal again
- opnk/offpunk: more informative prompt in less
- ansicat: added support for HTML description elements <dt> and <dd> (by Bert Livens)
- opnk: added "--mode" command-line argument

## 2.1 - December 15th 2023
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)

M man/ansicat.1 => man/ansicat.1 +2 -0
@@ 54,6 54,8 @@ either thanks to the MIME type,
or from the file being rendered itself.
.It Fl \-mime Ar MIME
MIME type of the content to parse.
.It Fl \-mode Ar MODE
MODE to use to render to choose between normal (default), full or source
.It Fl \-url Ar URL ...
original URL of the content.
.El

M man/opnk.1 => man/opnk.1 +2 -0
@@ 37,6 37,8 @@ path to the file or URL to open.
.Bl -tag -width Ds -offset indent
.It Fl h , \-help
Show a help message and exit
.It Fl \-mode Ar MODE
MODE to use to render to choose between normal (default), full or source
.El
.
.Sh EXIT STATUS

M opnk.py => opnk.py +4 -1
@@ 280,12 280,15 @@ 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")
    args = parser.parse_args()
    cache = opencache()
    for f in args.content:
        cache.opnk(f)
        cache.opnk(f,mode=args.mode)

if __name__ == "__main__":
    main()