|
10 | 10 |
|
11 | 11 | ## Welcome to Thanix! |
12 | 12 |
|
13 | | -Thanix is an experimental cli application written in Rust for generating Rust code from yaml schema files like they are found as openAPI schemas. |
| 13 | +Thanix is an experimental cli application written in Rust for generating Rust code from yaml schema files like they are |
| 14 | +found as openAPI schemas. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +Be aware that Thanix currently is only developed on and for Linux distributions.<br> |
| 19 | +Support for other operating systems may be available in the future, but currently though it is not guaranteed to work. |
| 20 | + |
| 21 | +### Building from source |
| 22 | + |
| 23 | +Building from source provides you with the most recent updates and changes to Thanix. However, be aware that these |
| 24 | +may be unstable, so downloading a tagged release is advised. |
| 25 | + |
| 26 | +Also, make sure you **have the Rust programming language and Cargo installed**. |
| 27 | + |
| 28 | +To build Thanix from source you need to follow these steps: |
| 29 | + |
| 30 | +1. Download the source code. To do so, run this command in your Terminal: |
| 31 | + |
| 32 | +```bash |
| 33 | +git clone git@github.com:The-Nazara-Project/Thanix.git |
| 34 | +``` |
| 35 | + |
| 36 | +This will create a new directory called `Thanix`, move into it. |
| 37 | + |
| 38 | +2. Run the application directly |
| 39 | + |
| 40 | +You can now run Thanix using the `cargo run` command. However, this process may take longer and may feel less |
| 41 | +comfortable. |
| 42 | + |
| 43 | +**Do not forget to pass the required CLI parameters to Thanix when doing this.** |
| 44 | + |
| 45 | +```bash |
| 46 | +cargo run -- --input-file $PATH_TO_YOUR_YAML --uri $URI_TO_YOUR_API |
| 47 | +``` |
| 48 | + |
| 49 | +This may look like this: |
| 50 | + |
| 51 | +```bash |
| 52 | +cargo run -- --input-file ./api_config.yaml --uri https://demo.netbox.dev |
| 53 | +``` |
| 54 | + |
| 55 | +> **NOTE:** Make sure that you **do not end your URI with a slash (/)**. As this would mangle the API paths. |
| 56 | +
|
| 57 | +This step will result in your `thanix_client` being generated. |
| 58 | + |
| 59 | +To view the next steps please scroll **down to the Usage section**. |
| 60 | + |
| 61 | +Optional: |
| 62 | + |
| 63 | +3. Install Thanix using `cargo install`. |
| 64 | + |
| 65 | +You can also install the crate on your system, so you always have it available. |
| 66 | +To do so, run this command while in the Thanix project directory: |
| 67 | + |
| 68 | +```bash |
| 69 | +cargo install --path . |
| 70 | +``` |
| 71 | + |
| 72 | +This will install Thanix onto your system and it can be executed by simply running `thanix` in your terminal. |
| 73 | + |
| 74 | +### Install Thanix using Cargo |
| 75 | + |
| 76 | +Thanix is also published on [crates.io](https://crates.io). |
| 77 | + |
| 78 | +To install it simply run: |
| 79 | + |
| 80 | +```bash |
| 81 | +cargo install thanix |
| 82 | +``` |
| 83 | + |
| 84 | +### Install Cargo as a distribution package (TBA) |
| 85 | + |
| 86 | +We are working on building packages for a variety of Linux distributions starting with `openSUSE Tumbleweed`. |
| 87 | + |
| 88 | +We will update you as soon as we have news. |
| 89 | + |
| 90 | +## Usage |
| 91 | + |
| 92 | +After you have installed Thanix in a way you see fit, you use it by passing it **two mandatory parameters** like this: |
| 93 | + |
| 94 | +```bash |
| 95 | +thanix --input-file $YOUR_API_YAML --uri $YOUR_API_URI |
| 96 | +``` |
| 97 | + |
| 98 | +- The `--input-file` parameter is a path to your `.yaml`-file you want to use as an input. This is usually the API |
| 99 | + schema file your want to generate a client for. |
| 100 | +- The `--uri` is the URI to your API in a format like this: `https://demo.netbox.dev`. |
| 101 | + **Make sure this URI does not end with a `/`** |
0 commit comments