mirror of
https://gitea.invidious.io/iv-org/protodec.git
synced 2024-08-15 00:43:18 +00:00
Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
9e02d88a19 | ||
|
c6cede69e6 | ||
|
11813ae363 | ||
|
618a336060 | ||
|
7de78da0f8 |
3 changed files with 31 additions and 5 deletions
30
README.md
30
README.md
|
@ -2,6 +2,30 @@
|
||||||
|
|
||||||
Command-line tool to encode and decode arbitrary protobuf data.
|
Command-line tool to encode and decode arbitrary protobuf data.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This program requires Crystal. See: https://crystal-lang.org/install/
|
||||||
|
|
||||||
|
### Standalone
|
||||||
|
|
||||||
|
1. Clone: `git clone https://github.com/iv-org/protodec && cd protodec`
|
||||||
|
2. Build: `crystal build src/protodec.cr`
|
||||||
|
3. See [Usage](#Usage) below
|
||||||
|
|
||||||
|
|
||||||
|
### As a Crystal library
|
||||||
|
|
||||||
|
Add this to your application's `shard.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
protodec:
|
||||||
|
github: iv-org/protodec
|
||||||
|
version: ~> 0.1.5
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -57,9 +81,13 @@ $ echo 'CkEKCeOCj+OBn+OBlxDSCSIQWmQ730+N8z8tsp3vp8YJQCoSCAESBzA4MDAwMDAaBQ26sSZE
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
Windows users can run the binaries in a linux-on-windows tool (like Git bash or WSL) or use the official [protobuf binaries](https://github.com/protocolbuffers/protobuf/releases) to encode/decode protobuf data.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
1. Fork it (<https://github.com/omarroth/protodec/fork>)
|
1. Fork it (<https://github.com/iv-org/protodec/fork>)
|
||||||
2. Create your feature branch (`git checkout -b my-new-feature`)
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||||
3. Commit your changes (`git commit -am 'Add some feature'`)
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||||
4. Push to the branch (`git push origin my-new-feature`)
|
4. Push to the branch (`git push origin my-new-feature`)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: protodec
|
name: protodec
|
||||||
version: 0.1.4
|
version: 0.1.5
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Omar Roth <omarroth@protonmail.com>
|
- Omar Roth <omarroth@protonmail.com>
|
||||||
|
|
|
@ -468,9 +468,7 @@ module Protodec
|
||||||
Any.new(raw.clone)
|
Any.new(raw.clone)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cast_json(object)
|
def self.cast_json(object : Hash)
|
||||||
raise "Invalid type" if !object.is_a?(Hash)
|
|
||||||
|
|
||||||
JSON::Any.new(object.transform_values do |value|
|
JSON::Any.new(object.transform_values do |value|
|
||||||
case value
|
case value
|
||||||
when .is_a?(Hash)
|
when .is_a?(Hash)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue