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
//! [![](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 clipboard;
pub mod fs;
pub mod keyboard;
pub mod macros;
pub mod mouse;
pub mod structs;
pub mod timer;
pub mod traits;
pub mod utils;

pub use fs::fs::*;
pub use macros::macros::*;
pub use structs::structs::*;
pub use timer::impl_timer::*;
pub use traits::traits::*;

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

///```rust
///     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(())
}