Skip to content

Commit 6a8c982

Browse files
committed
docs: added download command
1 parent 1c503c2 commit 6a8c982

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

README.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Definitions
2+
This repository contains all definitions for Code0. These definitions will be used to create a Flow. It also contains a CLI tool for managing definitions and a reader for reading all definitions.
23

34
## Definition CLI
45

@@ -7,27 +8,46 @@
78

89
### Usage
910
(Stay inside the root directory when running the command)
10-
### General Report
11+
12+
#### Download
13+
Will download the latest Definitions from the Code0 Definition Repository.
14+
15+
If no feature is specified, all features will be downloaded. If a feature is specified, only that feature will be kept & can be loaded by one of the following languages: TypeScript, Rust.
16+
17+
```bash
18+
./cargo run download
19+
./cargo run download -f feature_1 feature_2 feature_3
20+
```
21+
22+
#### General Report
23+
Will create a report of all errors in the definitions.
24+
1125
```bash
1226
./cargo run report
1327
./cargo run report -p /path/to/definitions
1428
```
1529

16-
### Feature Report
30+
#### Feature Report
31+
Will create a report of all errors in the definitions for a specific feature. Will also report on all specified functions, data types, and flow types.
32+
1733
```bash
1834
./cargo run feature
1935
./cargo run feature -p /path/to/definitions
2036
./cargo run feature -f feature_name
2137
./cargo run feature -f feature_name -p /path/to/definitions
2238
```
2339

24-
### Watch for Changes
40+
#### Watch for Changes
41+
Will run the report each time a definition file changes.
42+
2543
```bash
2644
./cargo run watch
2745
./cargo run watch -p /path/to/definitions
2846
```
2947

30-
### Definition
48+
#### Definition
49+
Will search for a specific definition.
50+
3151
```bash
3252
./cargo run definition -n definition_name
3353
./cargo run definition -n definition_name -p /path/to/definitions
@@ -53,3 +73,24 @@ for (const feature in features) {
5373
}
5474
```
5575

76+
## Rust Definition Package
77+
78+
### Install Package
79+
```bash
80+
cargo add code0-definition-reader
81+
```
82+
83+
### Usage
84+
85+
```rs
86+
use code0_definition_reader::Definition;
87+
88+
let features = Definition::new("./path/to/definitions");
89+
90+
for feature in features {
91+
let name = feature.name(); //name of the feature (e.g. rest)
92+
let data_types = feature.data_types(); //dataTypes of this feature
93+
let flow_types = feature.flow_types(); //flowTypes of this feature
94+
let functions = feature.runtime_functions(); //runtimeFunctions of this feature
95+
}
96+
```

0 commit comments

Comments
 (0)