1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! [![](https://gitlab.com/andrew_ryan/doe/-/raw/master/doe.svg)](https://docs.rs/doe)

#![doc(
    html_logo_url = "https://gitlab.com/andrew_ryan/doe/-/raw/master/html_logo.svg",
    html_favicon_url = "https://gitlab.com/andrew_ryan/doe/-/raw/master/html_favicon.svg"
)]

pub mod utils;
pub mod macros;
pub mod structs;
pub mod traits;
pub mod time;
pub mod fs;
pub mod clipboard;
pub mod mouse;
pub mod keyboard;

pub use structs::structs::*;
pub use macros::macros::*;
pub use traits::traits::*;
pub use time::time::*;
pub use fs::fs::*;


pub type DynError = Result<(),Box<dyn std::error::Error>>;

///```rust
/// fn main(){
///     doe::system("ls"); 
///     doe::system("ls -a"); 
/// }
/// ```
pub fn system(command: impl ToString) -> std::io::Result<()> {
    use std::process::Command;
    if cfg!(target_os = "windows") {
        Command::new("powershell")
        .arg("-Command")
        .arg(&command.to_string())
        .status()?;
    }else{
        Command::new("sh")
        .arg("-c")
        .arg(&command.to_string())
        .status()?;
    }
    Ok(())
}