mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
add pretty-print to mers cli
This commit is contained in:
parent
f3f2c13702
commit
7bfdbca3a5
1
mers/Cargo.toml
Executable file → Normal file
1
mers/Cargo.toml
Executable file → Normal file
@ -14,3 +14,4 @@ repository = "https://github.com/Dummi26/mers"
|
|||||||
mers_lib = "0.6.0"
|
mers_lib = "0.6.0"
|
||||||
# mers_lib = { path = "../mers_lib" }
|
# mers_lib = { path = "../mers_lib" }
|
||||||
clap = { version = "4.3.19", features = ["derive"] }
|
clap = { version = "4.3.19", features = ["derive"] }
|
||||||
|
colored = "2.1.0"
|
||||||
|
@ -3,6 +3,7 @@ use mers_lib::prelude_compile::*;
|
|||||||
use std::{path::PathBuf, process::exit, sync::Arc};
|
use std::{path::PathBuf, process::exit, sync::Arc};
|
||||||
|
|
||||||
mod cfg_globals;
|
mod cfg_globals;
|
||||||
|
mod pretty_print;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
struct Args {
|
struct Args {
|
||||||
@ -34,6 +35,11 @@ enum Command {
|
|||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
source: From,
|
source: From,
|
||||||
},
|
},
|
||||||
|
/// Add syntax highlighting to the code
|
||||||
|
PrettyPrint {
|
||||||
|
#[command(subcommand)]
|
||||||
|
source: From,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
#[derive(Subcommand, Clone)]
|
#[derive(Subcommand, Clone)]
|
||||||
enum From {
|
enum From {
|
||||||
@ -145,5 +151,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Command::PrettyPrint { source } => {
|
||||||
|
pretty_print::pretty_print(get_source(source));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
mers/t.mers
10
mers/t.mers
@ -1,3 +1,7 @@
|
|||||||
print_sum := iter -> iter.sum.println
|
// hello
|
||||||
|
if some_condition {
|
||||||
(1, 2, 3, "a").print_sum
|
{ ref: &my_var }
|
||||||
|
} else {
|
||||||
|
[Int] (by_value)
|
||||||
|
}
|
||||||
|
// end
|
||||||
|
Loading…
Reference in New Issue
Block a user