shell_util/
options.rs

1use std::{collections::HashMap, path::PathBuf};
2
3use serde::{Deserialize, Serialize};
4
5use crate::encoding::Encoding;
6
7#[derive(Debug, Clone, Deserialize, Eq, PartialEq, Serialize)]
8#[serde(default, rename_all = "camelCase")]
9pub struct CommandOptions {
10  pub cwd: Option<PathBuf>,
11
12  pub env: HashMap<String, String>,
13
14  /// Clear the environment variables of the spawned process.
15  pub clear_env: bool,
16
17  /// Character encoding for stdout/stderr.
18  pub encoding: Encoding,
19}
20
21impl Default for CommandOptions {
22  fn default() -> Self {
23    Self {
24      cwd: None,
25      env: HashMap::default(),
26      clear_env: false,
27      encoding: Encoding::Utf8,
28    }
29  }
30}