aboutsummaryrefslogtreecommitdiff
path: root/docs/pages/1-getting-started.md
blob: a701d7a82e62f23fd585ea88b12af9e49cfc2680 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<h1 align="center">Getting Started</h1>

## Create a New Project

```bash
cargo new my-cli
cd my-cli
```
 
## Add Dependency

Add the following to `Cargo.toml`:

```toml
[dependencies.mingling]
version = "0.2.1"
features = []
```
 
## Enable Features

**Mingling** has all features disabled by default and does **not** provide an all-in-one feature like `full`.

Some features **directly affect the entire lifecycle behavior**, so you need to enable them as needed, e.g.:

```toml
[dependencies.mingling]
version = "0.2.1"
features = [
    "parser",
    "comp",
]
```
 
> [!NOTE]
> Visit [docs.rs](https://docs.rs/mingling/latest/mingling/feature/index.html) or [Features](pages/other/features) to learn about all features.

## Write the Basic Entry Point

Write the following code in `src/main.rs`:

```rust
use mingling::prelude::*;
 
fn main() {
    let mut program = ThisProgram::new();
 
    program.exec_and_exit();
}
 
gen_program!();
```
 
> [!IMPORTANT]
> Almost all Rust code blocks in the docs have been compiled in CI and are guaranteed to work.
>
> However, code blocks starting with `// NOT VERIFIED` are **not verified**.
>
> Want to know which `*.md` files are compiled? See [`verified-docs.toml`](https://github.com/mingling-rs/mingling/blob/main/verified-docs.toml).

## Verify with Compilation

```plaintext
~# cargo check
```
 
---

Once everything is good, start writing something!