https://github.com/zcyc/protorenumber
a command-line tool that renumbers the fields in Protobuf (.proto) files while preserving the original field order
https://github.com/zcyc/protorenumber
Last synced: 3 months ago
JSON representation
a command-line tool that renumbers the fields in Protobuf (.proto) files while preserving the original field order
- Host: GitHub
- URL: https://github.com/zcyc/protorenumber
- Owner: zcyc
- License: mit
- Created: 2025-01-16T13:27:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-27T21:29:46.000Z (over 1 year ago)
- Last Synced: 2025-06-11T19:19:18.258Z (12 months ago)
- Language: Rust
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# protorenumber
protorenumber is a command-line tool written in Rust that renumbers the fields in Protobuf (`.proto`) files, preserving the original field order
The tool is particularly useful for developers who want to clean up or reorganise Protobuf files by assigning sequential field numbers starting from 1
## Features
- Automatically renumber field numbers in Protobuf files (starting at 1 and incrementing sequentially)
- Preserves the original field order in the Protobuf file
- Simple and easy-to-use CLI interface
## Install
```bash
cargo install --git https://github.com/zcyc/protorenumber
```
## Usage
### Command Syntax
```bash
protorenumber --input --output
```
### Arguments
- `--input` (or `-i`): The path to the input `.proto` file _(Required)_
- `--output` (or `-o`): The path to save the renumbered Protobuf file _(Required)_
### Example
```bash
protorenumber --input example.proto --output output.proto
```
Expected output:
```
Renumber proto file written to: output.proto
```
## Example Input and Output
### Input File (`example.proto`)
```proto
syntax = "proto3";
message User {
string name = 3;
int32 age = 1;
string email = 4;
}
message Product {
int32 id = 2;
string description = 6;
double price = 3;
}
```
### Output File (`output.proto`)
```proto
syntax = "proto3";
message User {
string name = 1;
int32 age = 2;
string email = 3;
}
message Product {
int32 id = 1;
string description = 2;
double price = 3;
}
```
## License
[MIT](LICENSE)