added windows placeholder terminal
This commit is contained in:
parent
7767ebf956
commit
ee5c845d7f
|
@ -14,4 +14,3 @@ serde = { version = "1.0.195", features = ["derive"] }
|
|||
serde_json = "1.0.111"
|
||||
nix = { version = "0.27.1", features = ["fs"] }
|
||||
homedir = "0.2.1"
|
||||
|
||||
|
|
|
@ -16,9 +16,14 @@ pub mod settings;
|
|||
pub mod shortcuts;
|
||||
pub mod file_tree;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub mod terminal;
|
||||
pub use terminal::*;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod windows_terminal;
|
||||
pub use windows_terminal::*;
|
||||
|
||||
pub mod tabs;
|
||||
pub use tabs::*;
|
||||
|
||||
|
|
57
src/tools/windows_terminal.rs
Normal file
57
src/tools/windows_terminal.rs
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Placeholder
|
||||
|
||||
pub struct Line {
|
||||
pub text: String,
|
||||
pub error: bool,
|
||||
}
|
||||
|
||||
impl Line {
|
||||
fn output(text: String) -> Self {
|
||||
Self {
|
||||
text: remove_line_break(text),
|
||||
error: false,
|
||||
}
|
||||
}
|
||||
fn error(text: String) -> Self {
|
||||
Self {
|
||||
text: remove_line_break(text),
|
||||
error: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CommandEntry {
|
||||
pub env: String,
|
||||
pub command: String,
|
||||
pub result: Vec<Line>,
|
||||
}
|
||||
|
||||
impl CommandEntry {
|
||||
pub fn new(env: String, command: String) -> Self {
|
||||
CommandEntry {
|
||||
env,
|
||||
command,
|
||||
result: vec![Line::error("General Kenobi")],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_command(command: String) -> CommandEntry {
|
||||
return CommandEntry::new("windows>", "hello there");
|
||||
}
|
||||
|
||||
|
||||
fn remove_line_break(input: String) -> String {
|
||||
let mut text = input.clone();
|
||||
while text.ends_with('\n') {
|
||||
text.pop();
|
||||
if text.ends_with('\r') {
|
||||
text.pop();
|
||||
}
|
||||
}
|
||||
text
|
||||
}
|
Loading…
Reference in a new issue