Skip to content

Commit

Permalink
cli: Prepare CLI for first publish
Browse files Browse the repository at this point in the history
  • Loading branch information
evestera committed Apr 21, 2017
1 parent 6b056ce commit 5ec1b3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
12 changes: 9 additions & 3 deletions json_typegen_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ name = "json_typegen_cli"
version = "0.1.0"
authors = ["Erik Vesteraas <erik@vestera.as>"]
license = "MIT/Apache-2.0"
description = "Command line interface for codegen from JSON samples"
description = "Command line utility for generating Rust types from JSON samples"
keywords = ["json", "code-generation", "cli", "serde"]
categories = ["command-line-utilities", "encoding"]
homepage = "https://github.com/evestera/json_typegen"
repository = "https://github.com/evestera/json_typegen"
documentation = "https://docs.rs/json_typegen_cli"
readme = "../README.md"
readme = "README.md"

[dependencies]
clap = "~2.19.0"
rustfmt = "0.7"
json_typegen_shared = { path = "../json_typegen_shared" }
json_typegen_shared = { path = "../json_typegen_shared", version = "0.1" }

[[bin]]
name = "json_typegen"
path = "src/main.rs"
22 changes: 13 additions & 9 deletions json_typegen_cli/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
# CLI for JSON code generation for Rust

**Note**: The main intended interface for this code generation is a procedural macro. See [the main readme](../README.md) for details.
**Note**: The main intended interface for this code generation is a procedural macro. See [its docs](https://docs.rs/crate/json_typegen) for details.


## Installation

Since the crate is not on crates.io yet, this is a bit more cumbersome than it will be in the future. Due to using `rustfmt` to make code look reasonable, compilation also takes a while. If you are impatient, you can use the [web interface](../README.md#web-interface) in the meantime.

```
git clone https://github.com/evestera/json_typegen
cd json_typegen/json_typegen_cli
cargo install
```sh
cargo install json_typegen_cli
# installed binary is called json_typegen
```

Due to the fact that this tool uses `rustfmt` to make code look reasonable, compilation takes a while. If you are impatient, you can use the [web interface](http://vestera.as/json_typegen/) in the meantime.

## Usage

To generate the type `Point` in `point.rs` from an online sample, run:
To generate the type `Point` in `point.rs` from a local sample, run:

```
json_typegen json_samples/point.json -o src/point.rs -n Point
```

Or for an online sample, run:

```
json_typegen_cli 'http://vestera.as/json_typegen/examples/point.json' -o src/point.rs -n Point
json_typegen 'http://vestera.as/json_typegen/examples/point.json' -o src/point.rs -n Point
```

The generated code assumes the availability of `serde` and `serde_derive`, so make sure your `Cargo.toml` contains something like:
Expand Down

0 comments on commit 5ec1b3c

Please sign in to comment.