face-hh / subterfuge

A CLI tool designed to gamify your TypeScript learning.
Apache License 2.0
129 stars 15 forks source link

a bunch of errors occur upon compiling src/main.rs #13

Open Ponali opened 5 months ago

Ponali commented 5 months ago

i can't actually tell what type of issue this is, but i'm sure that, when i try compiling src/main.rs, a bunch of errors occur. here's the terminal output:

ponali@computer-id:~/Documents/subterfuge-master/src$ rustc main.rs
error[E0433]: failed to resolve: maybe a missing crate `crossterm`?
 --> tui.rs:1:5
  |
1 | use crossterm::style::Stylize;
  |     ^^^^^^^^^ maybe a missing crate `crossterm`?
  |
  = help: consider adding `extern crate crossterm` to use the `crossterm` crate

error[E0433]: failed to resolve: maybe a missing crate `crossterm`?
 --> main.rs:8:5
  |
8 | use crossterm::style::Stylize;
  |     ^^^^^^^^^ maybe a missing crate `crossterm`?
  |
  = help: consider adding `extern crate crossterm` to use the `crossterm` crate

error[E0432]: unresolved import `rand`
 --> tui.rs:2:5
  |
2 | use rand::Rng;
  |     ^^^^ maybe a missing crate `rand`?
  |
  = help: consider adding `extern crate rand` to use the `rand` crate

error[E0432]: unresolved import `fancy_regex`
 --> main.rs:9:5
  |
9 | use fancy_regex::Regex;
  |     ^^^^^^^^^^^ maybe a missing crate `fancy_regex`?
  |
  = help: consider adding `extern crate fancy_regex` to use the `fancy_regex` crate

error[E0432]: unresolved import `rand`
  --> main.rs:10:5
   |
10 | use rand::Rng;
   |     ^^^^ maybe a missing crate `rand`?
   |
   = help: consider adding `extern crate rand` to use the `rand` crate

error[E0432]: unresolved import `serde_json`
  --> main.rs:11:5
   |
11 | use serde_json::{Result, Value};
   |     ^^^^^^^^^^ maybe a missing crate `serde_json`?
   |
   = help: consider adding `extern crate serde_json` to use the `serde_json` crate

error[E0599]: no method named `cyan` found for reference `&'static str` in the current scope
  --> tui.rs:16:68
   |
16 |         "𐂃  Hey there, seems like you're using locked features :)".cyan()
   |                                                                    ^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:20:70
   |
20 |         "|********************************************************|".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:24:70
   |
24 |         "|                       Error dump                       |".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:28:70
   |
28 |         "|                                                        |".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:37:70
   |
37 |         "|________________________________________________________|".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:48:70
   |
48 |         "|********************************************************|".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:50:36
   |
50 |     println!("{} {}", "| Problem:".dark_grey(), problem.name.cyan());
   |                                    ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
  --> tui.rs:50:62
   |
50 |     println!("{} {}", "| Problem:".dark_grey(), problem.name.cyan());
   |                                                              ^^^^ method not found in `String`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:53:26
   |
53 |         "| Description:".dark_grey(),
   |                          ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
  --> tui.rs:54:29
   |
54 |         problem.description.cyan()
   |                             ^^^^ method not found in `String`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:58:21
   |
58 |         "| Bounty:".dark_grey(),
   |                     ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
  --> tui.rs:59:35
   |
59 |         problem.money.to_string().cyan(),
   |                                   ^^^^ method not found in `String`

error[E0599]: no method named `cyan` found for reference `&'static str` in the current scope
  --> tui.rs:60:13
   |
60 |         "$".cyan()
   |             ^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:64:16
   |
64 |         "| #:".dark_grey(),
   |                ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
  --> tui.rs:65:35
   |
65 |         problem.index.to_string().cyan(),
   |                                   ^^^^ method not found in `String`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:69:26
   |
69 |         "| Boilerplate:".dark_grey(),
   |                          ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
  --> tui.rs:70:49
   |
70 |         problem.starting_code.replace("\n", "").cyan(), // it breaks things lol
   |                                                 ^^^^ method not found in `String`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
  --> tui.rs:74:70
   |
74 |         "|________________________________________________________|".dark_grey()
   |                                                                      ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `yellow` found for reference `&'static str` in the current scope
   --> tui.rs:114:42
    |
114 |     println!("┏━  {}  ━┓", "BATTLE PASS".yellow());
    |                                          ^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> tui.rs:122:45
    |
122 |         let mut end = "┗━━━━━━━━━━━━━━━━━┛".dark_grey();
    |                                             ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> tui.rs:123:49
    |
123 |         let mut semiend = "┃━━━━━━━━━━━━━━━━━┃".dark_grey();
    |                                                 ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for struct `String` in the current scope
   --> tui.rs:127:11
    |
124 |           let mut in_between = format!(
    |  ______________________________-
125 | |             "┣#{}━━━━━━━━━━━━━━┫",
126 | |             _format_index(&(i - 1).to_string())
127 | |         ).dark_grey();
    | |          -^^^^^^^^^ method not found in `String`
    | |__________|
    | 

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> tui.rs:132:27
    |
132 |         let mut bar = "┃".dark_grey();
    |                           ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `green` found for reference `&'static str` in the current scope
   --> tui.rs:137:23
    |
137 |             bar = "┃".green();
    |                       ^^^^^ method not found in `&str`

error[E0599]: no method named `yellow` found for reference `&'static str` in the current scope
   --> tui.rs:146:23
    |
146 |             bar = "┃".yellow();
    |                       ^^^^^^ method not found in `&str`

error[E0599]: no method named `on_black` found for struct `String` in the current scope
   --> tui.rs:154:54
    |
154 |         let title = format!("{bar} {} {bar}", _title.on_black().cyan());
    |                                                      ^^^^^^^^ method not found in `String`

error[E0599]: no method named `on_black` found for struct `String` in the current scope
   --> tui.rs:155:60
    |
155 |         let mut reward = format!("{bar} {} {bar}", _reward.on_black().cyan());
    |                                                            ^^^^^^^^ method not found in `String`

error[E0599]: no method named `on_black` found for struct `String` in the current scope
   --> tui.rs:156:46
    |
156 |         let p = format!("{bar} {} {bar}", _p.on_black().red());
    |                                              ^^^^^^^^ method not found in `String`

error[E0599]: no method named `blue` found for struct `String` in the current scope
   --> tui.rs:159:67
    |
159 |             reward += &format!("   ◄ {}/200 XP", save_file.bp_xp).blue().to_string()
    |                                                                   ^^^^
    |
help: there is a method `le` with a similar name, but with different arguments
   --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/cmp.rs:1188:5

error[E0599]: no method named `dark_blue` found for reference `&'static str` in the current scope
   --> tui.rs:162:42
    |
162 |             reward += &"   🮤 200/200 XP".dark_blue().to_string()
    |                                          ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
   --> tui.rs:190:39
    |
190 |     println!("{bar} {} {bar}", _intro.cyan());
    |                                       ^^^^ method not found in `String`

error[E0599]: no method named `white` found for reference `&'static str` in the current scope
   --> tui.rs:195:33
    |
195 |         let mut additional = "".white();
    |                                 ^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> tui.rs:198:43
    |
198 |             additional = "🮤 You're here!".dark_grey()
    |                                           ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
   --> tui.rs:201:69
    |
201 |         println!("┣ {}. {} {}", problem.index, problem.name.clone().cyan(), additional);
    |                                                                     ^^^^ method not found in `String`

error[E0599]: no method named `yellow` found for reference `&'static str` in the current scope
   --> tui.rs:205:94
    |
205 |         println!("┗ {}", "Congrats, you've completed the game! Was a blast having you on :D".yellow())
    |                                                                                              ^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> tui.rs:212:35
    |
212 |     println!("{} {}", "! Wallet:".dark_grey(), money.dark_green());
    |                                   ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_green` found for struct `String` in the current scope
   --> tui.rs:212:54
    |
212 |     println!("{} {}", "! Wallet:".dark_grey(), money.dark_green());
    |                                                      ^^^^^^^^^^ method not found in `String`

error[E0599]: no method named `dark_grey` found for struct `String` in the current scope
   --> tui.rs:229:27
    |
229 |             i.to_string().dark_grey(),
    |                           ^^^^^^^^^ method not found in `String`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
   --> tui.rs:230:26
    |
230 |             item.clone().cyan(),
    |                          ^^^^ method not found in `String`

error[E0599]: no method named `green` found for struct `String` in the current scope
   --> tui.rs:232:30
    |
232 |                 cost.clone().green()
    |                              ^^^^^ method not found in `String`

error[E0599]: no method named `red` found for struct `String` in the current scope
   --> tui.rs:234:30
    |
234 |                 cost.clone().red()
    |                              ^^^ method not found in `String`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:272:19
    |
272 |         let _1 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:273:19
    |
273 |         let _2 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:274:19
    |
274 |         let _3 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:275:19
    |
275 |         let _4 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:276:19
    |
276 |         let _5 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:277:19
    |
277 |         let _6 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:278:19
    |
278 |         let _7 = (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow();
    |                   ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:280:20
    |
280 |         let __1 = (rand::thread_rng().gen_range(1..10).to_string() + "%").yellow();
    |                    ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:281:20
    |
281 |         let __2 = (rand::thread_rng().gen_range(1..10).to_string() + "%").yellow();
    |                    ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:282:20
    |
282 |         let __3 = (rand::thread_rng().gen_range(1..10).to_string() + "%").yellow();
    |                    ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:283:20
    |
283 |         let __4 = (rand::thread_rng().gen_range(1..10).to_string() + "%").yellow();
    |                    ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> tui.rs:284:20
    |
284 |         let __5 = (rand::thread_rng().gen_range(1..10).to_string() + "%").yellow();
    |                    ^^^^ use of undeclared crate or module `rand`

error[E0599]: no method named `yellow` found for reference `&'static str` in the current scope
   --> tui.rs:288:50
    |
288 |         println!("{}", "It's your lucky chance!".yellow());
    |                                                  ^^^^^^ method not found in `&str`

error[E0599]: no method named `green` found for reference `&'static str` in the current scope
   --> tui.rs:309:47
    |
309 |     println!("\n{} {} {}", "Congratulations!".green(), "[Click here]".yellow(), "to claim your COUPON!".green())
    |                                               ^^^^^ method not found in `&str`

error[E0599]: no method named `yellow` found for reference `&'static str` in the current scope
   --> tui.rs:309:71
    |
309 |     println!("\n{} {} {}", "Congratulations!".green(), "[Click here]".yellow(), "to claim your COUPON!".green())
    |                                                                       ^^^^^^ method not found in `&str`

error[E0599]: no method named `green` found for reference `&'static str` in the current scope
   --> tui.rs:309:105
    |
309 |     println!("\n{} {} {}", "Congratulations!".green(), "[Click here]".yellow(), "to claim your COUPON!".green())
    |                                                                                                         ^^^^^ method not found in `&str`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
  --> main.rs:21:23
   |
21 |     let json: Value = serde_json::from_str(&json_string).unwrap();
   |                       ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> main.rs:113:24
    |
113 |     let wheel_chance = rand::thread_rng().gen_range(1..10);
    |                        ^^^^ use of undeclared crate or module `rand`

error[E0599]: no method named `yellow` found for struct `String` in the current scope
   --> main.rs:149:67
    |
149 |                 line.replace(snippet, &snippet.red().to_string()).yellow()
    |                                                                   ^^^^^^ method not found in `String`

error[E0599]: no method named `white` found for struct `String` in the current scope
   --> main.rs:151:14
    |
146 |               let err1 = format!(
    |  ________________________-
147 | |                 "|- {}. {}",
148 | |                 (line_number + 1),
149 | |                 line.replace(snippet, &snippet.red().to_string()).yellow()
150 | |             )
151 | |             .white();
    | |             -^^^^^ method not found in `String`
    | |_____________|
    | 

error[E0599]: no method named `red` found for struct `String` in the current scope
   --> main.rs:154:38
    |
154 |                 feature.item.clone().red()
    |                                      ^^^ method not found in `String`

error[E0599]: no method named `cyan` found for struct `String` in the current scope
   --> main.rs:171:31
    |
171 |         &problem.clone().name.cyan()
    |                               ^^^^ method not found in `String`

error[E0599]: no method named `red` found for reference `&'static str` in the current scope
   --> main.rs:178:65
    |
178 |         return println!("{}", "𐂃  Your code did not pass... :/".red());
    |                                                                 ^^^ method not found in `&str`

error[E0599]: no method named `green` found for reference `&'static str` in the current scope
   --> main.rs:190:70
    |
190 |         "𐂃  You did it! Run \"current\" to see your next challenge.".green(),
    |                                                                      ^^^^^ method not found in `&str`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:199:27
    |
199 |     let mut json: Value = serde_json::from_str(&json_string).unwrap();
    |                           ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0599]: no method named `red` found for reference `&'static str` in the current scope
   --> main.rs:204:61
    |
204 |         return println!("{}", "𐂃  You can't afford this :(".red());
    |                                                             ^^^ method not found in `&str`

error[E0599]: no method named `red` found for reference `&'static str` in the current scope
   --> main.rs:213:54
    |
213 |         return println!("{}", "Feature not found :(".red());
    |                                                      ^^^ method not found in `&str`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:219:31
    |
219 |     let updated_json_string = serde_json::to_string_pretty(&json).unwrap();
    |                               ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:228:27
    |
228 |     let mut json: Value = serde_json::from_str(&json_string).unwrap();
    |                           ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:257:31
    |
257 |     let updated_json_string = serde_json::to_string_pretty(&json).unwrap();
    |                               ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:266:27
    |
266 |     let mut json: Value = serde_json::from_str(&json_string).unwrap();
    |                           ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `serde_json`
   --> main.rs:270:31
    |
270 |     let updated_json_string = serde_json::to_string_pretty(&json).unwrap();
    |                               ^^^^^^^^^^ use of undeclared crate or module `serde_json`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> main.rs:275:58
    |
275 |     let _ = fs::copy(file_path, "history/".to_owned() + &rand::thread_rng().gen_range(10..10000).to_string() + file_path);
    |                                                          ^^^^ use of undeclared crate or module `rand`

error[E0599]: no method named `red` found for reference `&'static str` in the current scope
   --> main.rs:296:30
    |
296 |                 "ATTENTION!".red(),
    |                              ^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for reference `&'static str` in the current scope
   --> main.rs:297:26
    |
297 |                 "COUPON".cyan(),
    |                          ^^^^ method not found in `&str`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
   --> main.rs:298:18
    |
298 |                 (rand::thread_rng().gen_range(10..100).to_string() + "%").yellow(),
    |                  ^^^^ use of undeclared crate or module `rand`

error[E0599]: no method named `on_green` found for reference `&'static str` in the current scope
   --> main.rs:299:37
    |
299 |                 "[Click to reveal]".on_green().black()
    |                                     ^^^^^^^^ method not found in `&str`

error[E0599]: no method named `cyan` found for reference `&'static str` in the current scope
   --> main.rs:301:31
    |
301 |             "𐂃  Subterfuge\n".cyan(),
    |                               ^^^^ method not found in `&str`

error[E0599]: no method named `dark_cyan` found for reference `&'static str` in the current scope
   --> main.rs:302:51
    |
302 |             "Learning TypeScript the Temu way!\n".dark_cyan().italic(),
    |                                                   ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `dark_grey` found for reference `&'static str` in the current scope
   --> main.rs:303:305
    |
303 | ...complete the game, you need to solve all (10) problems. Commands are listed below for help.\n".dark_grey().italic(),
    |                                                                                                   ^^^^^^^^^ method not found in `&str`

error[E0599]: no method named `yellow` found for struct `String` in the current scope
   --> main.rs:342:16
    |
339 |       let arg = arg2.unwrap_or_else(|| {
    |  _______________-
340 | |         println!("Please provide the content creator.");
341 | |         process::exit(1)
342 | |     }).clone().yellow();
    | |               -^^^^^^ method not found in `String`
    | |_______________|
    | 

error: aborting due to 88 previous errors

Some errors have detailed explanations: E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0432`.

apparently, copy-pasting removes ANSI, so you may see the colors removed.

mybearworld commented 5 months ago

You have to use cargo for the dependencies to work.