reef 0.0.28

a package to execute and log system commands
Documentation
/*!
This crate provides a library for executing system commands.

# Usage

This crate is [on crates.io](https://crates.io/crates/reef) and can be
used by adding `reef` to your dependencies in your project's `Cargo.toml`.

```toml
[dependencies]
reef = "0"
```

If you're using Rust 2015, then you'll also need to add it to your crate root:

```rust
extern crate reef;
```

# Example: execute a command that is in the system PATH

note: git must be available in the system PATH for this example to work.

```rust
use reef::Command;
let git_version = Command::new("git --version",&std::env::temp_dir()).exec().unwrap();
assert!(git_version.stdout.contains("git version"));
```

*/

#![crate_name = "reef"]
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::path::PathBuf;
use std::time::Duration;

#[macro_use]
extern crate error_chain;
pub mod duration;
pub mod errors;
pub enum LogFormat {
    Message,
    LevelTargetMessage,
}
pub mod logger;
mod path;

// #region Structs
pub enum Status {
    Unknown,
    Ok,
    Error,
    Warning,
}
mod status;

pub struct Settings {
    pub log_path: PathBuf,
    pub log_limit: usize,
    pub log_to_console: bool,
}
mod settings;

// #region struct Env
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
/// Metadata about the environment
pub struct Env {
    /// The username
    pub username: String,
    /// The hostname,
    pub hostname: String,
    /// The distro
    pub distro: String,
    /// The real name for the user
    pub realname: String,
    /// The device name
    pub devicename: String,
}
mod env;
// #endregion struct Env

// #region struct Command
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq)]
/// Metadata about a std::process::Command
pub struct Command {
    /// The working directory
    pub dir: PathBuf,
    /// The command name
    pub name: String,
    /// The command arguments
    pub args: Vec<String>,
    /// The standard output text
    pub stdout: String,
    /// The standard error text
    pub stderr: String,
    /// Indication of success or failure
    pub success: bool,
    /// The exit code of the process
    pub exit_code: i32,
    /// The duration of the command execution
    pub duration: Duration,
    /// The timeout duration for the command execution
    pub timeout: Duration,
    /// The start time of the command execution
    pub start: String,
    /// Environment metadata
    pub env: Env,
    /// Tags
    pub tags: HashSet<String>,
    /// UUID
    pub uuid: String,
}
mod command;
// #endregion struct Command

pub struct History {
    pub commands: Vec<Command>,
}
mod history;
// #endregion Structs