insect
insect copied to clipboard
Feature to share multi-line history
Currently, insect.sh remembers the last command on the query part of the URL.
When sharing the link, this means that multiple lines that depend on each other, can't be shared in this way.
I was thinking of the following enhancement: If there's support for a %0A
or some other line termination character and the instructions could be executed one by one after splitting on that character.
Note: @sharkdp I just became sponsor as a thank you! You can judge whether this feature request is a priority to you or not. Just know that I'd love to see this added. ;)
Thank you for your feature request.
I agree that this would be nice. However, where would it stop? If someone has a 20 line history, should all commands be appended in the URL?
This is very much related to https://github.com/sharkdp/insect/issues/145.
Note: @sharkdp I just became sponsor as a thank you!
Thank you very much!
I realize this would add UI complexity, but would a "share" button (or similar), with a field to choose how many lines of history are included, not be the best solution here?
The maximum length of a query is already capped (saw something like a 2k character limit in a path). Why not allow anything within the RFC constraint?
In case it exceeds the RFC limit it could simply not offer the share option or give a warning when attempting a share. But in most cases a multi-line calculation is within the limit.
Ok, I'd be okay with adding a "share" button below the terminal. Or a new share
terminal command.
Splitting the input into multiple lines and executing each of them in succession is probably not a huge deal. But someone would have to add the necessary HTML+JavaScript to support this.
I personally wouldn't know where to start. 😳 Hopefully there is somebody who is familiar with the code who's interested in the feature.
The place to start would be here:
https://github.com/sharkdp/insect/blob/1bce3a9c8f835de9eb00c074306893aaf520748c/web/index.html#L132-L138
Instead of calling term.exec(…)
on the full query string (queryParams.get("q")
), the input would need to be split into several lines, and then passed to term.exec(…)
in a loop.
If someone thinks this is still valuable, please file a new ticket in the follow-up project: https://github.com/sharkdp/numbat
Numbat already supports multi-line inputs and multi-line pasting (#145), so implementing this in Numbat is likely easier.