Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add quiet flag #13

Merged
merged 1 commit into from
Oct 23, 2024
Merged

feat: add quiet flag #13

merged 1 commit into from
Oct 23, 2024

Conversation

rfyiamcool
Copy link
Contributor

What type of PR is this?

I have a requirement to save the return result of the rpc,This feature is similar to curl's -o parameter.

(Optional) Translate the PR title into Chinese.

infra tearm 有一个需求,需要通过 shell kitexcall 来访问 rpcserver,通过解析返回的 json 来做进一步的操作。而当前的 kitexcall 返回值里有 status 和 rpc response 信息,有时还会有 kitex sdk 的输出,这样的返回数据没法做 decode 解析。😁

$ ./kitexcall  -t protobuf -idl-path ~/west/starryshore/modules/ticket_server/idl/ticket.proto -e 10.10.100.2:30015 -m TicketModel/ListTicketInfo -d '{"page": 1, "page_size": 1}'  -o kk.log

[Status]: Success

$ cat kk.log | jq .total
29

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rfyiamcool

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@DMwangnima
Copy link

DMwangnima commented Oct 23, 2024

我理解当前的输出可以认为是加了 -verbose,所以其实新加个 -quiet flag,只输出 rpc response 也能符合需求而且更符合命令行的做法?
image

@rfyiamcool
Copy link
Contributor Author

我理解当前的输出可以认为是加了 -verbose,所以其实新加个 -quite flag,只输出 rpc response 也能符合需求而且更符合命令行的做法? image

是的,其实可以的,加入 quiet 来实现 rpc body 输出,这个满足我们的需求。但不知道其他人有没有 save rpc resp 的需求。我改下pr,-o-quiet 都保留? 还是只做 quiet ?

@DMwangnima
Copy link

DMwangnima commented Oct 23, 2024

-quiet 可以直接用其他命令把输出的 rpc response 内容写入文件吧,我个人觉得不太需要 -o
另外可以顺便更新一下文档,非常感谢你的贡献~
image

@rfyiamcool rfyiamcool changed the title feat: add save rpc response feat: add quiet flag Oct 23, 2024
@Zzhiter Zzhiter merged commit 0c00dd2 into kitex-contrib:main Oct 23, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants