added src/output.rs to handle command output

adjusted todo.md
This commit is contained in:
2025-01-14 23:28:49 +01:00
parent 0f2a922232
commit b0e2e430b5
6 changed files with 212 additions and 183 deletions
+3 -4
View File
@@ -9,7 +9,7 @@ use sysinfo::{Pid, System};
use crate::make_padding_string;
use super::{apply_format, config::*};
use super::{apply_format, config::*, output::Output};
#[derive(Debug, Clone)]
pub struct Stack {
@@ -31,7 +31,7 @@ impl Stack {
}
/// formats and prints stack to string
pub fn to_formatted_string(&self, config: &Settings) -> Result<String> {
pub fn to_formatted_string(&self, config: &Config) -> Result<String> {
let mut buffer: String = "".to_string();
if self.stack.is_empty() {
@@ -58,9 +58,8 @@ impl Stack {
}
/// clear stack by deleting the associated stack file
pub fn clear_stack(&mut self, config: &Settings) -> Result<()> {
pub fn clear_stack(&mut self) -> Result<()> {
fs::remove_file(self.path.clone())?;
print!("echo 'stack cleared successfully.'");
Ok(())
}