forked from solderpunk/AV-98
close #39: implement --mode in opnk
This commit is contained in:
parent
6484cf3426
commit
2faf460f0f
|
@ -12,6 +12,7 @@
|
||||||
- offpunk: "gus" was broken, it is functionnal again
|
- offpunk: "gus" was broken, it is functionnal again
|
||||||
- opnk/offpunk: more informative prompt in less
|
- opnk/offpunk: more informative prompt in less
|
||||||
- ansicat: added support for HTML description elements <dt> and <dd> (by Bert Livens)
|
- ansicat: added support for HTML description elements <dt> and <dd> (by Bert Livens)
|
||||||
|
- opnk: added "--mode" command-line argument
|
||||||
|
|
||||||
## 2.1 - December 15th 2023
|
## 2.1 - December 15th 2023
|
||||||
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)
|
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)
|
||||||
|
|
|
@ -54,6 +54,8 @@ either thanks to the MIME type,
|
||||||
or from the file being rendered itself.
|
or from the file being rendered itself.
|
||||||
.It Fl \-mime Ar MIME
|
.It Fl \-mime Ar MIME
|
||||||
MIME type of the content to parse.
|
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 ...
|
.It Fl \-url Ar URL ...
|
||||||
original URL of the content.
|
original URL of the content.
|
||||||
.El
|
.El
|
||||||
|
|
|
@ -37,6 +37,8 @@ path to the file or URL to open.
|
||||||
.Bl -tag -width Ds -offset indent
|
.Bl -tag -width Ds -offset indent
|
||||||
.It Fl h , \-help
|
.It Fl h , \-help
|
||||||
Show a help message and exit
|
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
|
.El
|
||||||
.
|
.
|
||||||
.Sh EXIT STATUS
|
.Sh EXIT STATUS
|
||||||
|
|
5
opnk.py
5
opnk.py
|
@ -280,12 +280,15 @@ def main():
|
||||||
opnk will fallback to opening the file with xdg-open. If given an URL as input \
|
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."
|
instead of a path, opnk will rely on netcache to get the networked content."
|
||||||
parser = argparse.ArgumentParser(prog="opnk",description=descri)
|
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="*",
|
parser.add_argument("content",metavar="INPUT", nargs="*",
|
||||||
default=sys.stdin, help="Path to the file or URL to open")
|
default=sys.stdin, help="Path to the file or URL to open")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
cache = opencache()
|
cache = opencache()
|
||||||
for f in args.content:
|
for f in args.content:
|
||||||
cache.opnk(f)
|
cache.opnk(f,mode=args.mode)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue