forked from nonsensical-dev/zenyx-engine
fix formatting
This commit is contained in:
parent
1fb0ca75ed
commit
c38a0ccee3
3 changed files with 19 additions and 23 deletions
|
@ -1,14 +1,12 @@
|
||||||
use std::{ffi::OsStr, process::Command};
|
use std::{ffi::OsStr, process::Command};
|
||||||
|
|
||||||
|
|
||||||
use parking_lot::Mutex;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
use crate::core::repl::repl::evaluate_command;
|
|
||||||
|
|
||||||
use super::COMMAND_LIST;
|
use super::COMMAND_LIST;
|
||||||
const MAX_RECURSION_DEPTH: usize = 500; // increasing this value WILL cause a stack overflow. attempt at your own risk - Caz
|
use crate::core::repl::repl::evaluate_command;
|
||||||
|
const MAX_RECURSION_DEPTH: usize = 500; // increasing this value WILL cause a stack overflow. attempt at your own risk -
|
||||||
|
// Caz
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref RECURSION_DEPTH: Mutex<usize> = parking_lot::Mutex::new(0);
|
static ref RECURSION_DEPTH: Mutex<usize> = parking_lot::Mutex::new(0);
|
||||||
|
@ -59,11 +57,17 @@ pub(crate) fn exec(args: Vec<String>) -> anyhow::Result<()> {
|
||||||
println!("File path: {:#?}", file_path);
|
println!("File path: {:#?}", file_path);
|
||||||
|
|
||||||
if !file_path.is_file() {
|
if !file_path.is_file() {
|
||||||
eprintln!("Error: File does not exist or is not a valid file: {}", file_path.display());
|
eprintln!(
|
||||||
|
"Error: File does not exist or is not a valid file: {}",
|
||||||
|
file_path.display()
|
||||||
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if file_path.extension() != Some(OsStr::new("zensh")) {
|
if file_path.extension() != Some(OsStr::new("zensh")) {
|
||||||
eprintln!("Error: File is not a zenshell script: {:#?}", file_path.extension());
|
eprintln!(
|
||||||
|
"Error: File is not a zenshell script: {:#?}",
|
||||||
|
file_path.extension()
|
||||||
|
);
|
||||||
//TODO: dont panic on this error
|
//TODO: dont panic on this error
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ pub mod repl;
|
||||||
|
|
||||||
use std::{borrow::Borrow, collections::HashMap, sync::Arc};
|
use std::{borrow::Borrow, collections::HashMap, sync::Arc};
|
||||||
|
|
||||||
use anyhow::Ok;
|
use anyhow::Context;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
|
@ -42,11 +42,7 @@ impl Command {
|
||||||
}
|
}
|
||||||
Callable::WithArgs(f) => match args {
|
Callable::WithArgs(f) => match args {
|
||||||
Some(args) => f(args),
|
Some(args) => f(args),
|
||||||
None => {
|
None => Ok(()),
|
||||||
Ok(())
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +136,7 @@ impl CommandList {
|
||||||
.aliases
|
.aliases
|
||||||
.read()
|
.read()
|
||||||
.get_key_value(&name)
|
.get_key_value(&name)
|
||||||
.unwrap()
|
.context("Failed to get alias")?
|
||||||
.1
|
.1
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
|
@ -176,9 +172,7 @@ impl CommandList {
|
||||||
eprintln!("Did you mean: '{}'?", similar.green().italic().bold());
|
eprintln!("Did you mean: '{}'?", similar.green().italic().bold());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
None => {
|
None => Ok(()),
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ use std::{
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
@ -172,7 +170,7 @@ pub fn evaluate_command(input: &str) -> anyhow::Result<()> {
|
||||||
cmd_name.to_string(),
|
cmd_name.to_string(),
|
||||||
if args.is_empty() { None } else { Some(args) },
|
if args.is_empty() { None } else { Some(args) },
|
||||||
)?;
|
)?;
|
||||||
};
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue