From b28d221bcfd7fc7e787096222cd989911fe01f61 Mon Sep 17 00:00:00 2001 From: Vomitblood Date: Sun, 31 Mar 2024 01:15:01 +0800 Subject: [PATCH] asdf --- .github/workflows/graphs/testing.yml | 0 .github/workflows/testing.yml | 11 +++++ .vscode/settings.json | 5 --- Cargo.lock | 7 --- Cargo.toml | 1 - src/bin/testing.py | 6 +++ src/bin/testing.rs | 64 +++++++++++++++++++++++++++- src/main.rs | 11 ++--- 8 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/graphs/testing.yml create mode 100644 .github/workflows/testing.yml delete mode 100644 .vscode/settings.json create mode 100644 src/bin/testing.py diff --git a/.github/workflows/graphs/testing.yml b/.github/workflows/graphs/testing.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..c51556c --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,11 @@ +on: [push] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + name: My workflow + steps: + - name: Execute Action Graph + uses: actionforge/action@919d415a6b6e22919f7e115cf594ae52ded95041 # v0.8.31 + with: + graph_file: testing.yml \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 352a626..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rust-analyzer.linkedProjects": [ - "./Cargo.toml" - ] -} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index dd7705d..e05bb9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,12 +129,6 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -228,7 +222,6 @@ name = "rustmon" version = "0.1.0" dependencies = [ "clap", - "once_cell", "rand", "rust-embed", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 7fcad53..640f083 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,5 +8,4 @@ edition = "2021" clap = "2.0.0" rand = { version = "0.8.4", features = ["small_rng"] } serde_json = "1.0" -once_cell = "1.8.0" rust-embed = "8.3.0" diff --git a/src/bin/testing.py b/src/bin/testing.py new file mode 100644 index 0000000..613c71d --- /dev/null +++ b/src/bin/testing.py @@ -0,0 +1,6 @@ +x = 0 + +while x < 100000000: + x += 1 + +print(x) diff --git a/src/bin/testing.rs b/src/bin/testing.rs index 6686bd0..4d93ccb 100644 --- a/src/bin/testing.rs +++ b/src/bin/testing.rs @@ -1,3 +1,65 @@ +// fn main() { +// let mut numbers = [1, 2, 3, 4, 5]; + +// for i in numbers.iter_mut() { +// *i += 1; +// println!("{}", &*i + 1); +// } +// } + +// fn main() { +// let numbers = [1, 9, -2, 0, 23, 20, -7, 13, 37, 20, 56, -18, 20, 3]; +// let mut max: i32; +// let mut min: i32; +// let mean: f64; + +// max = numbers[0]; +// for n in numbers { +// if n > max { +// max = n; +// }; +// } + +// min = numbers[0]; +// for n in numbers { +// if n < min { +// min = n; +// }; +// } + +// let mut sum = 0; +// for n in numbers { +// sum += n; +// } + +// mean = sum as f64 / numbers.len() as f64; + +// assert_eq!(max, 56); +// assert_eq!(min, -18); +// assert_eq!(mean, 12.5); +// } + +// fn main() { +// let numbers = [1, 9, -2, 0, 23, 20, -7, 13, 37, 20, 56, -18, 20, 3]; + +// let max = *numbers.iter().max().unwrap(); +// let min = *numbers.iter().min().unwrap(); + +// let sum: i32 = numbers.iter().sum(); +// let mean = sum as f64 / numbers.len() as f64; + +// assert_eq!(max, 56); +// assert_eq!(min, -18); +// assert_eq!(mean, 12.5); +// } + +use std::io::Write; + fn main() { - println!("Hello, world!") + let mut string_input = String::new(); + print!("Enter a string: "); + std::io::stdout().flush().unwrap(); + std::io::stdin().read_line(&mut string_input).unwrap(); + let mut trimmed_string = string_input.trim().to_string().push_str("hello"); + println!("You entered: {}", trimmed_string); } diff --git a/src/main.rs b/src/main.rs index 64e87e3..845cba7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ const GENERATIONS: [(&str, (u32, u32)); 8] = [ ]; fn print_file(filepath: &str) -> std::io::Result<()> { - ColorScriptsDir::get(filepath) + return ColorScriptsDir::get(filepath) .map(|file| { let content = std::str::from_utf8(file.data.as_ref()).unwrap(); println!("{}", content); @@ -35,7 +35,7 @@ fn print_file(filepath: &str) -> std::io::Result<()> { .ok_or(std::io::Error::new( std::io::ErrorKind::NotFound, "File not found", - )) + )); } fn list_pokemon_names() -> std::io::Result<()> { @@ -59,7 +59,7 @@ fn list_pokemon_names() -> std::io::Result<()> { println!("Use the --name flag to view a specific Pokémon"); println!("Tip: Use `grep` to search for a specific Pokémon"); - Ok(()) + return Ok(()); } fn show_pokemon_by_name( @@ -132,7 +132,7 @@ fn show_pokemon_by_name( // Use the adjusted function to print file contents from embedded resources print_file(&file_path)?; - Ok(()) + return Ok(()); } fn show_random_pokemon( @@ -180,7 +180,7 @@ fn show_random_pokemon( std::process::exit(1); } - Ok(()) + return Ok(()); } #[cfg(target_os = "windows")] @@ -246,6 +246,7 @@ fn main() { .value_name("GENERATION") .help("Show a random pokemon. This flag can optionally be followed by a generation number or range (1-8) to show random pokemon from a specific generation or range of generations. The generations can be provided as a continuous range (eg. 1-3) or as a list of generations (1,3,6)"), ) + .after_help("P.S. Use the minimon command for a minimalistic version of this tool") .get_matches(); if matches.is_present("list") {