Skip to content

Commit

Permalink
Add sample module
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-zip committed Oct 21, 2023
1 parent ae005a8 commit 3a31a3a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions maid_docs/resources/sample/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod sample;
pub mod sample_structs;
36 changes: 36 additions & 0 deletions maid_docs/resources/sample/sample.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::modules::sample::sample_structs::*;
use crate::core::structs::ProcessInit;
use crate::core::messages::standard_messages;
use crate::core::utils::*;

pub fn sample(data: SampleData, debug: bool) -> bool {
let instance = ProcessInit {
source: &format!("foo {}", data.data),
source_from: "sample",
source_description: "Sample tool",
debug: debug,
};
system_command_exec(instance)
}

pub fn shell_lookup(system_input: Vec<String>) -> bool {
let cmd_arg_name = system_input[2].as_str();

match cmd_arg_name {

"--sample" => {
let debug = gsv_debug(gsv(system_input.clone(), "--debug"));
let instance = SampleData {
data: &gsv(system_input.clone(), "--sample"),
};

sample(instance, debug)
}

_ => {
standard_messages("warning", "Invalid user input", "shell_sample", "cute");
standard_messages("warning", "Trying exec command", cmd_arg_name, "cute");
return false;
}
}
}
3 changes: 3 additions & 0 deletions maid_docs/resources/sample/sample_structs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub struct SampleData<'data> {
pub data: &'data str,
}

0 comments on commit 3a31a3a

Please sign in to comment.