curl 作者开源 trurl,用于解析和操作 URL 的命令行工具

1,146次阅读
没有评论

curl 作者 Daniel 宣布推出新的开源项目:trurl,这是一款用于解析和操作 URL 的命令行工具,主要是面向 shell 脚本作者提供。Daniel 称项目名字中的 ‘tr’ 代表 translate 或 transpose。

curl 作者开源 trurl,用于解析和操作 URL 的命令行工具

Daniel 表示,URL 很难解析,因此导致软件存在许多安全问题。trurl 希望通过消除脚本和命令行作者到处重复发明轮子的需求来帮助缓解这个问题。

trurl 使用了 libcurl 的 URL 解析器,因此解析和理解 URL 的方式与命令行工具 curl 完全相同——使其成为完美的配套工具。

示例代码

$ trurl --url https://curl.se --set host=example.com
https://example.com/

$ trurl –set host=example.com –set scheme=ftp
ftp://example.com/

$ trurl –url https://curl.se/we/are.html –redirect here.html
https://curl.se/we/here.html

$ trurl –url https://curl.se/we/../are.html –set port=8080
https://curl.se:8080/are.html

$ trurl –url https://curl.se/we/are.html –get ‘{path}’
/we/are.html

$ trurl –url https://curl.se/we/are.html –get ‘{port}’
443

$ trurl https://example.com/hello.html –get ‘{scheme} {port} {path}’
https 443 /hello.html

$ trurl –url https://curl.se/hello –append path=you
https://curl.se/hello/you

$ trurl –url “https://curl.se?name=hello” –append query=search=string
https://curl.se/?name=hello&search=string

$ trurl –url-file url-list.txt –get ‘{host}’
[one host name per URL in the input file]

$ cat url-list.txt | trurl –url-file – –get ‘{host}’
[one host name per URL in the input file]

$ trurl “https://fake.host/hello#frag” –set user=::moo:: –json
[
{
“url”: “https://%3a%3amoo%3a%3a@fake.host/hello#frag”,
“scheme”: “https”,
“user”: “::moo::”,
“host”: “fake.host”,
“port”: “443”,
“path”: “/hello”,
“fragment”: “frag”
}
]

$ trurl “https://example.com?search=hello&utm_source=tracker” –trim query=”utm_*”
https://example.com/?search=hello

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 4 月
 12
3456789
10111213141516
17181920212223
24252627282930
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
手把手教你用AI 10分钟生成一个APP!零基础也能搞定

手把手教你用AI 10分钟生成一个APP!零基础也能搞定

今日,我将向大家展示DeepSeek的全新玩法——从零开始,利用AI创建一个完整的应用程序。借助DeepSee...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
手把手教你用AI 10分钟生成一个APP!零基础也能搞定

手把手教你用AI 10分钟生成一个APP!零基础也能搞定

今日,我将向大家展示DeepSeek的全新玩法——从零开始,利用AI创建一个完整的应用程序。借助DeepSee...