xvw / rust-cli-workshop

Workshop to learn and practice Rust (ongoing)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust

screenshot

Learn Rust by building Command Line Application

Repository used for workshop

🎯 What we will build

πŸ¦€ Crabby command line !

$ crabby --help

crabby 0.1.0
I am the crabby help usage.

USAGE:
    crabby <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    chifoumi    chifoumi with players
    greets      Greets with name
    help        Print this message or the help of the given subcommand(s)

πŸ“ Requirements

You'll need to install:

TLDR;

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

⚠️ Note on Windows

Rust requires certain C++ build tools. You can either download the Microsoft C++ Build Tools, or (recommended) you might prefer just to install Microsoft Visual Studio.

More about Installation setup on windows

Verify your toolchain version

Minimum Version : 1.64+

rustc --version
rustc 1.64.0 (a55dd71d5 2022-09-19)

Keep your rust up-to-date with the latest release of rust, type:

rustup update

Choose your IDE

More tools on Rust website

Alternative to IDE

When your computer is annoying or you are not admin...

πŸ“ Workshop instructions

πŸ‘€ Solutions

❗ Try your solution first. Errors help to learn with Rust

Each part have a working solution

// inside each directory 
cd <partx>/solutions
cargo run 

Run solutions :

// from git root directory
cargo run --bin crabby_setup
cargo run --bin crabby_syntax
cargo run --bin crabby_args
cargo run --bin crabby_cli

bin name is defined in related <partx>/solutions/Cargo.toml files

⚑ Tests

You are not required to write test during workshop but it always a good pratice so have a look !

// 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

πŸ“š Additional resources

About

Workshop to learn and practice Rust (ongoing)

License:MIT License


Languages

Language:Rust 100.0%