Skip to content

Commit

Permalink
✨ add help flag
Browse files Browse the repository at this point in the history
  • Loading branch information
KPMGE committed Mar 23, 2024
1 parent 1130542 commit ce7aa56
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ use std::io::{self, BufRead, Write};

use kl_rs::{evaluator::Evaluator, lexer::Lexer, parser::Parser, token::Token};

gflags::define! {
-h, --help = false
}
gflags::define! {
-v, --verbose = false
}

fn main() {
let stdin = std::io::stdin();
let mut handle = stdin.lock();
let mut evaluator = Evaluator::new();
gflags::parse();

if HELP.flag {
gflags::print_help_and_exit(0);
}

let mut evaluator = Evaluator::new();

loop {
let mut input = String::new();

Expand All @@ -37,6 +45,7 @@ fn main() {
let lexer = Lexer::new(input.to_string());
let mut parser = Parser::new(lexer.clone());


if VERBOSE.flag {
debug_lexer(lexer.clone());
debug_parser(parser.clone());
Expand Down

0 comments on commit ce7aa56

Please sign in to comment.