forked from koniifer/ableos
port clparse
This commit is contained in:
parent
e8221f8513
commit
e768c308e6
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -31,6 +31,7 @@ dependencies = [
|
|||
"axel",
|
||||
"bitflags",
|
||||
"bootloader",
|
||||
"clparse",
|
||||
"cpuio",
|
||||
"ext2",
|
||||
"externc-libm",
|
||||
|
@ -161,6 +162,16 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clparse"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/able/core_utils#46a97f827bd11f3cea8dcab797b9697d9485c4b3"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"log",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "2.0.0"
|
||||
|
|
|
@ -71,6 +71,8 @@ versioning = { git = "https://git.ablecorp.us/able/aos_userland" }
|
|||
# embedded-graphics = "*"
|
||||
pc-keyboard = "0.5"
|
||||
# mini-backtrace = "0.1"
|
||||
clparse = { git = "https://git.ablecorp.us/able/core_utils", default-features = false }
|
||||
|
||||
|
||||
[dependencies.linked_list_allocator]
|
||||
version = "0.9.0"
|
||||
|
|
|
@ -6,6 +6,7 @@ user_processes = ["shell"]
|
|||
enabled = true
|
||||
level = "Trace"
|
||||
log_to_serial = true
|
||||
log_to_vterm = false
|
||||
filter = ["ableos::ps2_mouse", "ableos::vterm"]
|
||||
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
|||
DecodedKey::Unicode(chr) => match chr {
|
||||
'\n' => {
|
||||
KEYBUFF.lock().push('\n');
|
||||
trace!("ENTER");
|
||||
}
|
||||
// Backspace
|
||||
'\u{8}' => {
|
||||
|
|
|
@ -52,6 +52,7 @@ impl Default for KernelConfig {
|
|||
pub struct LoggingConfig {
|
||||
pub enabled: bool,
|
||||
pub log_to_serial: bool,
|
||||
pub log_to_vterm: bool,
|
||||
pub level: LogLevel,
|
||||
pub filter: Vec<String>,
|
||||
}
|
||||
|
|
|
@ -17,3 +17,4 @@ impl DeviceID {
|
|||
}
|
||||
|
||||
pub const VMWARE_SVGA2: DeviceID = DeviceID::new(VMware, 0x0405);
|
||||
pub const S3INC_TRIO64V2: DeviceID = DeviceID::new(S3Inc, 0x8900);
|
||||
|
|
|
@ -9,7 +9,7 @@ use super::devices::*;
|
|||
pub fn check_pci_support(device_id: DeviceID) -> bool {
|
||||
match device_id {
|
||||
VMWARE_SVGA2 => true,
|
||||
|
||||
S3INC_TRIO64V2 => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ impl log::Log for SimpleLogger {
|
|||
None => 0,
|
||||
};
|
||||
|
||||
if KERNEL_CONF.logging.log_to_vterm {
|
||||
let msg = format!(
|
||||
// "[{}{}$RESET$][$GREEN${}$RESET$]{}\n",
|
||||
"[{}{:05}\0RESET\0][\0GREEN\0{}\0RESET\0][\0BLUE\0{}@{}\0RESET\0] {}",
|
||||
|
@ -58,7 +59,8 @@ impl log::Log for SimpleLogger {
|
|||
record.args(),
|
||||
);
|
||||
|
||||
// println!("{msg}");
|
||||
println!("{msg}");
|
||||
}
|
||||
|
||||
if KERNEL_CONF.logging.log_to_serial {
|
||||
serial_println!(
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
use crate::arch::drivers::sysinfo::master;
|
||||
use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2};
|
||||
use crate::devices::pci::brute_force_scan;
|
||||
use crate::image::mono_bitmap::bruh;
|
||||
use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE};
|
||||
use crate::time::fetch_time;
|
||||
use crate::KERNEL_STATE;
|
||||
|
@ -204,6 +203,21 @@ pub fn command_parser(user: String, command: String) {
|
|||
|
||||
let bin_name = iter.next().unwrap();
|
||||
|
||||
let mut strin = String::new();
|
||||
for stri in iter {
|
||||
trace!("{}", stri);
|
||||
strin.push_str(stri);
|
||||
}
|
||||
let conf_args;
|
||||
match clparse::Arguments::parse_from_string(strin) {
|
||||
Ok(ok) => conf_args = ok,
|
||||
Err(err) => {
|
||||
println!("ERROR: {}", err);
|
||||
error!("{}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
match bin_name {
|
||||
// note: able asked for rhaish to stay in the repo but will be removed
|
||||
// in the future so just comment it out for now
|
||||
|
@ -217,9 +231,12 @@ pub fn command_parser(user: String, command: String) {
|
|||
}
|
||||
}
|
||||
|
||||
"echo" => {
|
||||
echo_file(iter.next().unwrap().to_string(), fs);
|
||||
}
|
||||
"echo" => match conf_args.1.arguments.get("p") {
|
||||
Some(path) => echo_file(path.to_string(), fs),
|
||||
|
||||
None => println!("No path provided"),
|
||||
},
|
||||
"test" => {}
|
||||
|
||||
"quit" => shutdown(),
|
||||
|
||||
|
@ -252,8 +269,8 @@ pub fn command_parser(user: String, command: String) {
|
|||
let mut binary = vec![];
|
||||
file.read_to_end(&mut binary).unwrap();
|
||||
|
||||
let args = iter.collect::<Vec<&str>>();
|
||||
println!("{:?}", args);
|
||||
// let args = iter.collect::<Vec<&str>>();
|
||||
// println!("{:?}", args);
|
||||
run_program(&binary);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue