npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

proto-to-cli

v1.2.0

Published

A tool to convert Protocol Buffers files to command line interfaces.

Downloads

770

Readme

proto-to-cli

proto-to-cli 是一个用于将 Protocol Buffers 文件转换为命令行接口(CLI)工具的插件。通过该插件,你可以快速地根据 .proto 文件生成相应的 CLI 命令,方便开发者进行操作。

支持的生成目标

目前,proto-to-cli 支持以下目标适配器:

  1. commander: 生成基于 commander 库的 CLI 工具。

安装

首先,你需要确保已经安装了 Node.js 环境。然后可以通过 npm 安装 proto-to-cli

npm i proto-to-cli

使用方法

基本用法

proto-to-cli 提供了一个简单的命令行接口来生成代码。你可以使用以下命令来生成 CLI 工具:

proto-to-cli -i <proto文件路径> -t commander -m <消息名称> -o <输出文件路径>

参数说明

  • -i, --input : 指定输入的 .proto 文件路径。
  • -t, --target <target_name>: 指定目标适配器,默认值为 commander。
  • -m, --message_name : 指定 .proto 文件中的消息名称。
  • -o, --output : 指定生成的文件保存路径。

示例

假设你有一个名为 example.proto 的文件,并且你想将其转换为一个名为 my-cli 的 CLI 工具,你可以运行以下命令:

proto-to-cli -i example.proto -t commander -m MyMessage -o my-cli.ts

这将会生成一个 Typescript 文件 my-cli.ts

import { getCliParams } from 'my-cli.ts';
getCliParams(process.argv);

如果你有其他需求,欢迎提交 issue 或 pull request!

贡献

我们非常欢迎任何形式的贡献!如果你有任何想法或建议,请随时联系我们或提交 PR。

许可证

proto-to-cli 采用 MIT 许可证