~lioploum/offpunk-users

7 2

cat after image stack trace

Details
Message ID
<Z7ikyNxEkP4Af3XZ@thatit.be>
Sender timestamp
1740136056
DKIM signature
pass
Download raw message
Immediately after following a link to an image I ran the `cat` command
and the following trace popped out:

```
Traceback (most recent call last):
  File "/home/user/offpunk/offpunk.py", line 2218, in <module>
    main()
  File "/home/user/offpunk/offpunk.py", line 2212, in main
    gc.cmdloop()
  File "/nix/store/rfm2viz8cpyahnmraaayhmki7v9767gg-python3-3.12.8/lib/p
ython3.12/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
           ^^^^^^^^^^^^^^^^^
  File "/nix/store/rfm2viz8cpyahnmraaayhmki7v9767gg-python3-3.12.8/lib/p
ython3.12/cmd.py", line 217, in onecmd
    return func(arg)
           ^^^^^^^^^
  File "/home/user/offpunk/offpunk.py", line 140, in outer
    return inner(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/offpunk/offpunk.py", line 1101, in do_cat
    input=open(self.opencache.get_temp_filename(self.current_url), "rb")
,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

This was on NixOS (unstable) but using a local clone of offpunk.

```
commit 059cc366e90ae0725c692b4faca7c599458fccde
```
Details
Message ID
<174015667618.7.17508144762358975852.609982286@ploum.eu>
In-Reply-To
<Z7ikyNxEkP4Af3XZ@thatit.be> (view parent)
Sender timestamp
1740156669
DKIM signature
pass
Download raw message
Thanks for the report. I can reproduce it.

I’ve a question: what were you trying to achieve?

Given that there’s the "!" bang feature, I don’t see the purpose of 
"cat" and I’m considering removing the function.

Le 25 fév 21 11:07, Stephen a écrit :
>Immediately after following a link to an image I ran the `cat` command
>and the following trace popped out:
>
>```
>Traceback (most recent call last):
>  File "/home/user/offpunk/offpunk.py", line 2218, in <module>
>    main()
>  File "/home/user/offpunk/offpunk.py", line 2212, in main
>    gc.cmdloop()
>  File "/nix/store/rfm2viz8cpyahnmraaayhmki7v9767gg-python3-3.12.8/lib/p
>ython3.12/cmd.py", line 138, in cmdloop
>    stop = self.onecmd(line)
>           ^^^^^^^^^^^^^^^^^
>  File "/nix/store/rfm2viz8cpyahnmraaayhmki7v9767gg-python3-3.12.8/lib/p
>ython3.12/cmd.py", line 217, in onecmd
>    return func(arg)
>           ^^^^^^^^^
>  File "/home/user/offpunk/offpunk.py", line 140, in outer
>    return inner(self, *args, **kwargs)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File "/home/user/offpunk/offpunk.py", line 1101, in do_cat
>    input=open(self.opencache.get_temp_filename(self.current_url), "rb")
>,
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>TypeError: expected str, bytes or os.PathLike object, not NoneType
>```
>
>This was on NixOS (unstable) but using a local clone of offpunk.
>
>```
>commit 059cc366e90ae0725c692b4faca7c599458fccde
>```
>
>

-- 
Ploum - Lionel Dricot

Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Details
Message ID
<Z7jRIDZECwN9_zat@thatit.be>
In-Reply-To
<174015667618.7.17508144762358975852.609982286@ploum.eu> (view parent)
Sender timestamp
1740147408
DKIM signature
pass
Download raw message
On Fri, Feb 21, 2025 at 04:51:09PM +0000, Ploum wrote:
> Thanks for the report. I can reproduce it.
Oh, good.  I was worried it was a me thing.  I seem to run into a lot of
edge cases that aren't reproducible on other systems.

> I’ve a question: what were you trying to achieve?

Since I use kitty and it can display images, I thought maybe it might
show the image again.  But mostly I had just run help and saw there was
a cat command ;-)


> 
> Given that there’s the "!" bang feature, I don’t see the purpose of 
> "cat" and I’m considering removing the function.
I haven't used the ! feature.  Is there a way to send a targeted link
through the bang instead of the current thing?
Details
Message ID
<174016957954.7.16262016176527477053.610251213@ploum.eu>
In-Reply-To
<Z7jRIDZECwN9_zat@thatit.be> (view parent)
Sender timestamp
1740169572
DKIM signature
pass
Download raw message
Le 25 fév 21 02:16, Stephen a écrit :
>> I’ve a question: what were you trying to achieve?
>
>Since I use kitty and it can display images, I thought maybe it might
>show the image again.  But mostly I had just run help and saw there was
>a cat command ;-)

To view again, use "view" (or "v").

To send content to the shell, use "!"  (or "shell").  But this will work 
only with text content, not the picture.

You can, for example, grep through a page for STRING with "!grep STRING"
(this example is not really useful as grep is already implemented using 
"find" or "/", so you can do "/STRING". But it gives you the idea.
>
>>
>> Given that there’s the "!" bang feature, I don’t see the purpose of
>> "cat" and I’m considering removing the function.
>I haven't used the ! feature.  Is there a way to send a targeted link
>through the bang instead of the current thing?

I don’t really understand. You would like to do "shell 2" to send the 
content of link 2 to the shell, right?

Is there a reason to do that without accessing the link first? I’m 
trying to understand the usecase because it would be hard to implement: 
what if you have a command called "2" on which you want to run the 
content?

(note that you can do "view 2" to have information on the link without 
following it)


-- 
Ploum - Lionel Dricot

Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Details
Message ID
<Z7kFhgOxSDGRr8vP@thatit.be>
In-Reply-To
<174016957954.7.16262016176527477053.610251213@ploum.eu> (view parent)
Sender timestamp
1740160822
DKIM signature
pass
Download raw message
On Fri, Feb 21, 2025 at 08:26:12PM +0000, Ploum wrote:
> Le 25 fév 21 02:16, Stephen a écrit :
> >>
> >> Given that there’s the "!" bang feature, I don’t see the purpose of
> >> "cat" and I’m considering removing the function.
> >I haven't used the ! feature.  Is there a way to send a targeted link
> >through the bang instead of the current thing?
> 
> I don’t really understand. You would like to do "shell 2" to send the 
> content of link 2 to the shell, right?

I was thinking more of how to send just the link to the shell so that I
could, for example, open a new pane in tmux to run a second instance of
offpunky that would pull up that url.

I realize it's a bit redundant with the tour ability, but it would be
nice to be able to send arbitrary links off to arbitrary other program.


> 
> Is there a reason to do that without accessing the link first? I’m 
> trying to understand the usecase because it would be hard to implement: 
> what if you have a command called "2" on which you want to run the 
> content?

More like how you can send a link to the clipboard, but instead of the
clipboard, send it to an external command or script.
Details
Message ID
<174022130249.8.16411081093648690821.610778698@ploum.eu>
In-Reply-To
<Z7kFhgOxSDGRr8vP@thatit.be> (view parent)
Sender timestamp
1740221294
DKIM signature
pass
Download raw message
Le 25 fév 21 06:00, Stephen a écrit :
>
>I realize it's a bit redundant with the tour ability, but it would be
>nice to be able to send arbitrary links off to arbitrary other program.
>

I had a quick try at it and it was easy: from now on, you can pipe the 
"url" command.

So "url|CMD" and "url 121|CMD" should work.

It is a fairly advanced feature but it was easy to do and should not 
bring new bugs.

Note that "open 121" and "view 121" already work and cover 
straightforward usecases.

-- Ploum - Lionel Dricot

Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Details
Message ID
<Z7nJYFuP_sDK2vaL@thatit.be>
In-Reply-To
<174022130249.8.16411081093648690821.610778698@ploum.eu> (view parent)
Sender timestamp
1740210960
DKIM signature
pass
Download raw message
On Sat, Feb 22, 2025 at 10:48:14AM +0000, Ploum wrote:
> 
> So "url|CMD" and "url 121|CMD" should work.
> 

I think it's passing the base url (or current?) instead of the numbered
url.  For example:

```
ON> url
gemini://thatit.be
ON> url 1
gemini://thatit.be/2025-02-09-11-52-40.gmi
ON> url 1 | cat
gemini://thatit.be
gemini://thatit.be
```

using commit 91b056b7543db3d3aaac3fc34d74b6f01840f59c
Details
Message ID
<174023065797.8.2660066748040363023.610897713@ploum.eu>
In-Reply-To
<Z7nJYFuP_sDK2vaL@thatit.be> (view parent)
Sender timestamp
1740230650
DKIM signature
pass
Download raw message
Le 25 fév 22 07:56, Stephen a écrit :
>On Sat, Feb 22, 2025 at 10:48:14AM +0000, Ploum wrote:
>>
>> So "url|CMD" and "url 121|CMD" should work.
>>
>
>I think it's passing the base url (or current?) instead of the numbered
>url.  For example:
>
>```
>ON> url
>gemini://thatit.be
>ON> url 1
>gemini://thatit.be/2025-02-09-11-52-40.gmi
>ON> url 1 | cat
>gemini://thatit.be
>gemini://thatit.be

Ok, that was a bug caused by the space between 1 and | ( I usually don’t 
put a space there). It should be solved now.

-- 
Ploum - Lionel Dricot

Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Reply to thread Export thread (mbox)