feat: reorganize workbook into 3 tracks (core, engineering-2026, ecosystems)
This commit is contained in:
1 parent
82677455b2
commit
2e002b6176
64 files changed
+2295
-196
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# 01 — Parsowanie argumentów CLI z `clap`
|
||||
|
||||
`clap` (Command Line Argument Parser) to absolutny standard w ekosystemie Rusta do budowy narzędzi CLI.
|
||||
|
||||
## Zakres
|
||||
* Deklaratywne makra `#[derive(Parser)]` i `#[derive(Subcommand)]`
|
||||
* Flagi (`--verbose` / `-v`), opcje z wartościami domyślnymi, argumenty pozycyjne i podkomendy (`add`, `list`, `done`)
|
||||
* Testowanie parsera bez uruchamiania procesu: `Cli::try_parse_from(...)`
|
||||
|
||||
## Zadania (`src/lib.rs`)
|
||||
1. Uzupełnij atrybuty `clap` w strukturze `Cli` i enumie `Command` (np. `#[arg(short, long)]`, `#[command(subcommand)]`).
|
||||
2. Zaimplementuj `parse_cli(args: &[&str]) -> Result<Cli, clap::Error>` używając `Cli::try_parse_from(args)`.
|
||||
3. Zaimplementuj `describe_command(cli: &Cli) -> String`, aby zamienić sparsowaną komendę na czytelny opis (w prawdziwym CLI byłoby tu wywołanie logiki biznesowej).
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=eco01-cli-clap
|
||||
```
|
||||
Reference in new issue
Block a user