Refactor Common CLI Tools

栏目: IT技术 · 发布时间: 5年前

内容简介:All of us command line fans have our common CLI tools ready for tasks such as jq for json manipulation and curl for creating http requests.I decided to revisit this tools and refactor them to check if i can make them more flexible and easy to use basically

Refactor Common CLI Tools

All of us command line fans have our common CLI tools ready for tasks such as jq for json manipulation and curl for creating http requests.

I decided to revisit this tools and refactor them to check if i can make them more flexible and easy to use basically to make them a bit more modern.

This is the tools i created:

1. json-cli-tool - Manipulate json.

2. loop-pipe - Loop over piped data.

3. transform-cli - Transform data types for now just from and to base64.

* just to mention github-kit-cli this is the gkc in the example, basically until Github will finish their cli this is my solution.

gkc search repos -p="q=org:niradler" | jc --path="items" --flatMap="name" --output="newline" | lp "gkc repos getContents --p=\"owner=niradler&repo={v}&path=README.md\" | jc --path=\"content\" | tc --ft=\"base64\" --tt=\"txt\""

Lets breaks this down:

1.  query Github API to get my repos names. (gkc)

2. manipulate JSON response to a flattered list. (jc)

3. loop over the list of repos and run commands for each repo. (lp)

This tools will probably not replace jq, sed, xargs and others but i find them more easy to use so i can save this big guns for more heavy duty.

This is just a POC to test if this path is even a thing, do i really want to refactor an amazing tools that have been battle tests ? not sure about this, but for now im enjoying the easy usage, and testing new capabilities.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

B2B品牌管理

B2B品牌管理

(美)菲利普·科特勒、(德)弗沃德 / 楼尊 / 2008-1 / 35.00元

《B2B品牌管理》是第一本专门系统地阐述B2B品牌化的专业书籍,由营销大师菲利普•科特勒与弗沃德教授合作而成。他们以非凡的智慧和深厚的经验告诫B2B企业如何运用目标明确、重点突出的品牌化战略取得市场竞争优势地位,从而更加接近顾客,也更接近成功。在众多关于品牌的书籍中,《B2B品牌管理》的独特价值在于其根据实际环境探讨B2B品牌和品牌化问题,重点介绍和分析前沿的思想和最佳实践;通过与B2C企业的品牌......一起来看看 《B2B品牌管理》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具