Hello there,
Currently the workflow for images or third-party resources is a bit cumbersome
if images are not supported in the terminal:
- exit view mode
- open image url, which shows nothing
- use "open" to open in the handler, or "open url" to open in the browser
- use "back" to go back to the page
This is because "open" only works on the current page. Is it possible to make
it work on a target page, like tour ? Something like `open 3 6-10` to open all
the links directly via their url for example.
--
Matthieu Rakotojaona
On 24 jui 22 07:43, Matthieu Rakotojaona wrote:
>Hello there,>>Currently the workflow for images or third-party resources is a bit cumbersome>if images are not supported in the terminal:>>- exit view mode>- open image url, which shows nothing>- use "open" to open in the handler, or "open url" to open in the browser>- use "back" to go back to the page>>This is because "open" only works on the current page. Is it possible to make>it work on a target page, like tour ? Something like `open 3 6-10` to open all>the links directly via their url for example.
This is actually a very good idea as I found myself multiple times
trying to open links.
I implemented opening one or multiple links with "open". It works with
or without "url" as the first parameter.
Testing is welcome!
Ploum <sourcehut24@ploum.eu> wrote:
> Testing is welcome!
Awesome ! It works exactly as expected. I love where this is going.
Here are a few quirks I came into:
- when using an invalid "index", offpunk crashes:
```
ON> open sanothue
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/offpunk.py", line 1052, in do_open
n = int(a)
^^^^^^
ValueError: invalid literal for int() with base 10: 'sanothue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/offpunk", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.12/site-packages/offpunk.py", line 1956, in main
gc.cmdloop()
File "/usr/lib/python3.12/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/cmd.py", line 217, in onecmd
return func(arg)
^^^^^^^^^
File "/usr/lib/python3.12/site-packages/offpunk.py", line 130, in outer
return inner(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/offpunk.py", line 1056, in do_open
print("Non-numeric index %s, skipping." % index)
^^^^^
NameError: name 'index' is not defined
```
- ranges don't work (the conversion to int, as above, fails)
- `open url` doesn't work anymore, it only opens the current page with the handler
- I'm still not living in the disconnected world yet, so I think I still want to open urls for multiple links/images: something like `open url 2 3 4`
- `help open` doesn't mention this new thing
I'm sorry I list more negative than positive things, but I absolutely love this (and the reactivity) !
--
Matthieu Rakotojaona
On 24 jui 22 11:50, Matthieu Rakotojaona wrote:
>Ploum <sourcehut24@ploum.eu> wrote:>> Testing is welcome!>>>Awesome ! It works exactly as expected. I love where this is going.>>Here are a few quirks I came into:>>- when using an invalid "index", offpunk crashes:
Ooops, forgot to check that. My bad.
>- ranges don't work (the conversion to int, as above, fails)
Yeah, I know. I didn’t want to copy/paste the range code from tour so I
did a quick implementation.
Ideally, the code should be refactored so that tour and open could share
some code. It should not be really hard and contributions are welcome on
this.
>>- `open url` doesn't work anymore, it only opens the current page with the handler
strange, it works for me. "open" open the cached page. "open url" goes
to the url. Just checked and it works for me.
>>>- I'm still not living in the disconnected world yet, so I think I still want to open urls for multiple links/images: something like `open url 2 3 4`
That’s how it should work (sole requirement is that "url" should be the
first parameter)
>>- `help open` doesn't mention this new thing
Nice catch, fixed!
>>I'm sorry I list more negative than positive things, but I absolutely love this (and the reactivity) !
That’s what tests are for. Thanks for this ;-)
--
Ploum - Lionel Dricot
Blog: https://www.ploum.net
Livres: https://ploum.net/livres.html