Skip to content

Commit 3d6e698

Browse files
committed
use std env args instead of clap
1 parent 4e7991b commit 3d6e698

File tree

3 files changed

+14
-165
lines changed

3 files changed

+14
-165
lines changed

Cargo.lock

Lines changed: 12 additions & 154 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ repository = "https://github.com/zahash/csc"
1010
[dependencies]
1111
regex = { version = "1" }
1212
lazy_static = { version = "1" }
13-
clap = { version = "4", features = ["derive"] }
1413
rustyline = { version = "12" }
1514

1615
[dev-dependencies]

src/prompt.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::eval::*;
22

3-
use clap::Parser;
43
use rustyline::error::ReadlineError;
54

65
const LOGO: &'static str = r#"
@@ -11,16 +10,9 @@ const LOGO: &'static str = r#"
1110
██████ ███████ ██████
1211
"#;
1312

14-
/// CSC
15-
#[derive(Parser)]
16-
struct Cli {
17-
/// run one off computations instead of launching the prompt
18-
expr: Option<Vec<String>>,
19-
}
20-
2113
pub fn run() {
22-
if let Some(expr) = Cli::parse().expr {
23-
let expr = expr.join(" ");
14+
let expr = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
15+
if !expr.trim().is_empty() {
2416
match eval(expr.as_str(), &mut State::new()) {
2517
Ok(res) => println!("{}", res),
2618
Err(e) => eprintln!("{:?}", e),

0 commit comments

Comments
 (0)