Open vlcinsky opened 2 years ago
@vlcinsky Thanks for the suggestion. It does indeed make sense to add this. Will work on it
@vlcinsky Pushed 1.0.9 out just now. Works as I would expect locally. Let me know, otherwise I'll close this issue
@MKaterbarg well done.
I have tested it in my neovim and now I can easily decode the url as needed.
There is one small caveat (which is not critical).
If I search for something in google, e.g. for the term urlrecode
, the links look like leading directly to the found page but in fact they are leading first to google (to track my click) and from there are redirecting to real url.
When I decode a line of text in my neovim, it takes complete line incl. newline. For this reason when I decode an url and then encode it again, it adds extra %0A
to the end.
value of url
query parameter of the google redirect:
https%3A%2F%2Fpypi.org%2Fproject%2Furlrecode%2F1.0.2%2F
can be decoded into:
https://pypi.org/project/urlrecode/1.0.2/
and when encoded (in neovim) egain, I get:
https%3A//pypi.org/project/urlrecode/1.0.2/%0A
I am not sure, if the encoding result seem correct (original encoded and final encoded value differs) but in regards to extraneous %0A
I would propose to strip
blanks from the encoded value to prevent this.
Oh that's a good point. While that's not so bad on the decode, it does indeed lead to an issue on encode.
Thanks @MKaterbarg for this simple but very handy tool.
I am able to call the utility as prescribed and get expected results.
However, it would make things simpler, if it would follow CLI pattern of many tools such as gzip, bzip2, grep, wc, jq .... to allow passing the last textual content to process from stdin.
Then I could do things such as:
Some CLI tools are require to specify
-
to read stdin. On the other hand, many tools consider missing last argument as clear sign to read it from stdin.Hint: If you would use
click
library, these things would be a breeze.PS: I like the name urlrecode - very easy to remember.