https://github.com/jrollin/rust-cli-workshop
Workshop to learn and practice Rust by building CLI (ongoing)
https://github.com/jrollin/rust-cli-workshop
cli-app learning-by-doing rust workshop
Last synced: 5 months ago
JSON representation
Workshop to learn and practice Rust by building CLI (ongoing)
- Host: GitHub
- URL: https://github.com/jrollin/rust-cli-workshop
- Owner: jrollin
- License: mit
- Created: 2022-06-15T14:29:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-30T12:57:18.000Z (12 months ago)
- Last Synced: 2026-01-21T15:59:45.215Z (6 months ago)
- Topics: cli-app, learning-by-doing, rust, workshop
- Language: Rust
- Homepage:
- Size: 127 KB
- Stars: 19
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/jrollin/rust-cli-workshop/actions/workflows/rust.yml)

# Learn Rust by building Command Line Application
Repository used for workshop
- [DevFest 2022](https://devfest2022.gdgnantes.com/sessions/apprenez_rust_pas_a_pas_en_construisant_une_application_en_ligne_de_commande)
- [Touraine Tech 2023](https://2023.touraine.tech/talk/8Y1SA6Pfjj2LIrbUa037)
- [Devoxx France 2023](https://www.linkedin.com/posts/julien-rollin_devoxx2023-rust-workshop-activity-7052547713011175424-Y9eJ?utm*source=share&utm_medium=member_desktop&rcm=ACoAAASjY7MBTgDoEfy3CVx-9lB7ne*-jg9ZcGk)
## :dart: What we will build
🦀 Crabby command line !
```
$ crabby --help
Crabby cli
Usage: crabby_api
Commands:
greets Greets with name
chifoumi Play chifoumi with players
search Search news by keyword
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
```
## :pencil: Requirements
You'll need to install:
- [Rust installation instructions](https://www.rust-lang.org/tools/install)
TLDR;
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
:warning: Note on Windows
Rust requires certain C++ build tools.
You can either download the [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), or (recommended) you might prefer just to install [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/).
[More about Installation setup on windows](https://learn.microsoft.com/en-us/windows/dev-environment/rust/setup)
### Verify your toolchain version
Minimum Version : 1.72+ (tested with 1.8.8)
```bash
rustc --version
```
```bash
rustc 1.72.1 (d5c2e9c34 2023-09-13)
```
Keep your rust up-to-date with the latest release of rust, type:
```bash
rustup update
```
### Choose your IDE
- VS Code:
- [Rust Analyzer Language Server Protocol](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
- [TOML](https://marketplace.visualstudio.com/items?itemName=bungcip.better-toml)
- Jetbrains Rust:
- https://www.jetbrains.com/fr-fr/rust/
- Vim/Neovim plugin :
- https://github.com/simrat39/rust-tools.nvim
[More tools on Rust website](https://www.rust-lang.org/tools)
### Alternative to IDE
> When your computer is annoying or you are not admin...
- Online Playground
- https://play.rust-lang.org/
- gitpod (inside brower or in your IDE)
- [](https://gitpod.io/#https://github.com/jrollin/rust-cli-workshop)
## :pencil: Workshop instructions
- [Part 1 - Env setup](./1_setup)
- [Part 2 - Syntax](./2_syntax)
- [Part 3 - Command args and options](./3_args)
- [Part 4 - Modules and conversion](./4_mod)
- [Part 5 - Better command help documenter son application](./5_cli)
- [Part 6 - Api call with Json Parsing](./6_api)
### :eyes: Solutions
> :exclamation: Try your solution first. Errors help to learn with Rust
Each part have a working solution
```bash
// inside each directory
cd /solutions
cargo run
```
Run solutions :
```bash
// from git root directory
cargo run --bin crabby_setup
cargo run --bin crabby_syntax
cargo run --bin crabby_args
cargo run --bin crabby_cli
cargo run --bin crabby_api
```
> bin name is defined in related `/solutions/Cargo.toml` files
### :zap: Tests
> You are not required to write test during workshop but it always a good pratice so have a look !
```bash
// all
cargo test
//specific
cargo test --bin crabby_setup
cargo test --bin crabby_syntax
cargo test --bin crabby_args
cargo test --bin crabby_mod
cargo test --bin crabby_cli
cargo test --bin crabby_api
```
## :books: Additional resources
- [Rust Book](https://doc.rust-lang.org/book/)
- [Rust by Example](https://doc.rust-lang.org/rust-by-example/)