Skip to content

Commit

Permalink
Help Message for Interactive shell
Browse files Browse the repository at this point in the history
  • Loading branch information
the-rectifier committed Nov 24, 2021
1 parent a9dc8e1 commit 5d965f1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pad = "0.1.6"
sudoku = "0.7.0"
anyhow = "1.0.44"
serialport = "4.0.1"
Expand Down
26 changes: 14 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use colored::*;
use std::thread;
use pad::PadStr;
use std::fs::File;
use std::time::Duration;
use structopt::StructOpt;
Expand Down Expand Up @@ -422,7 +423,7 @@ fn go_interactive(port: &mut Port, sudoku: &lib::SudokuAvr, flag: bool) -> Resul
continue;
}
lib::write_uart(port, [b'N', x, y, z, b'\x0D', b'\x0A'].as_ref())?;
lib::wait_response(port, b"OK\x0D\x0A")?;
lib::wait_response(port, OK)?;
},
"debug" => {
if user_input_vec.len() > 3 {
Expand Down Expand Up @@ -483,15 +484,16 @@ fn recv_and_check(port: &mut Port, sudoku: &lib::SudokuAvr) -> Result<()> {


fn print_help() {
println!("{}", "Available Commands: ".yellow());
println!("at");
println!("download");
println!("break");
println!("fill");
println!("debug");
println!("exit");
println!("clear");
println!("solution");
println!("unsolved");
println!("help | '?' ");
println!("{}", "Available Commands: ".yellow().bold());
println!("{}{}", "at".pad_to_width(20), "Attention");
println!("{}{}", "clear".pad_to_width(20), "Clear Board");
println!("{}{}", "play".pad_to_width(20), "Play Game");
println!("{}{}", "fill".pad_to_width(20), "Fill Cell [x y num]");
println!("{}{}", "solution".pad_to_width(20), "Print Solution");
println!("{}{}", "unsolved".pad_to_width(20), "Print Board");
println!("{}{}", "download".pad_to_width(20), "Download Board to AVR");
println!("{}{}", "break".pad_to_width(20), "Break");
println!("{}{}", "debug".pad_to_width(20), "Return the contents of a Cell [x y num]");
println!("{}{}", "exit".pad_to_width(20), "Exit");
println!("{}{}", "help or ?".pad_to_width(20), "Print this Help message");
}

0 comments on commit 5d965f1

Please sign in to comment.