mirror of
https://github.com/rust-lang/rustlings
synced 2024-11-18 09:25:36 +00:00
Remove highlighting and syntect
This commit is contained in:
parent
41170ce341
commit
62696f5819
@ -8,7 +8,6 @@ edition = "2018"
|
|||||||
clap = "2.32.0"
|
clap = "2.32.0"
|
||||||
indicatif = "0.9.0"
|
indicatif = "0.9.0"
|
||||||
console = "0.6.2"
|
console = "0.6.2"
|
||||||
syntect = "3.0.2"
|
|
||||||
notify = "4.0.0"
|
notify = "4.0.0"
|
||||||
toml = "0.4.10"
|
toml = "0.4.10"
|
||||||
serde = {version = "1.0.10", features = ["derive"]}
|
serde = {version = "1.0.10", features = ["derive"]}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Thanks for installing `rustlings`!
|
Thanks for installing Rustlings!
|
||||||
|
|
||||||
## Is this your first time?
|
Is this your first time?
|
||||||
|
|
||||||
Let's make sure you're up to speed:
|
Let's make sure you're up to speed:
|
||||||
- You have Rust installed, preferably via `rustup`
|
- You have Rust installed, preferably via `rustup`
|
||||||
@ -9,9 +9,7 @@ Let's make sure you're up to speed:
|
|||||||
- You have installed Rust language support for your editor
|
- You have installed Rust language support for your editor
|
||||||
- You have locally installed the `rustlings` command by running:
|
- You have locally installed the `rustlings` command by running:
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo install --path .
|
cargo install --path .
|
||||||
```
|
|
||||||
|
|
||||||
If you've done all of this (or even most of it), congrats! You're ready
|
If you've done all of this (or even most of it), congrats! You're ready
|
||||||
to start working with Rust.
|
to start working with Rust.
|
17
src/main.rs
17
src/main.rs
@ -6,14 +6,9 @@ use notify::DebouncedEvent;
|
|||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::BufRead;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use syntect::easy::HighlightFile;
|
|
||||||
use syntect::highlighting::{Style, ThemeSet};
|
|
||||||
use syntect::parsing::SyntaxSet;
|
|
||||||
use syntect::util::as_24_bit_terminal_escaped;
|
|
||||||
|
|
||||||
mod exercise;
|
mod exercise;
|
||||||
mod run;
|
mod run;
|
||||||
@ -35,9 +30,6 @@ fn main() {
|
|||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let ss = SyntaxSet::load_defaults_newlines();
|
|
||||||
let ts = ThemeSet::load_defaults();
|
|
||||||
|
|
||||||
if None == matches.subcommand_name() {
|
if None == matches.subcommand_name() {
|
||||||
println!();
|
println!();
|
||||||
println!(r#" welcome to... "#);
|
println!(r#" welcome to... "#);
|
||||||
@ -92,13 +84,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if matches.subcommand_name().is_none() {
|
if matches.subcommand_name().is_none() {
|
||||||
let mut highlighter =
|
let text = fs::read_to_string("default_out.txt").unwrap();
|
||||||
HighlightFile::new("default_out.md", &ss, &ts.themes["base16-eighties.dark"]).unwrap();
|
println!("{}", text);
|
||||||
for maybe_line in highlighter.reader.lines() {
|
|
||||||
let line = maybe_line.unwrap();
|
|
||||||
let regions: Vec<(Style, &str)> = highlighter.highlight_lines.highlight(&line, &ss);
|
|
||||||
println!("{}", as_24_bit_terminal_escaped(®ions[..], true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("\x1b[0m");
|
println!("\x1b[0m");
|
||||||
|
Loading…
Reference in New Issue
Block a user