1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct SessionChoice {
6 pub name: String,
7 pub command: Option<Vec<String>>,
9}
10
11impl SessionChoice {
12 #[must_use]
13 pub fn default_session() -> Self {
14 Self {
15 name: "Default session".to_owned(),
16 command: None,
17 }
18 }
19}
20
21impl fmt::Display for SessionChoice {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 f.write_str(&self.name)
24 }
25}
26
27#[derive(Debug, Clone, PartialEq, Eq)]
29pub struct SessionSpec {
30 pub username: String,
31 pub uid: u32,
32 pub gid: u32,
33 pub command: Vec<String>,
34 pub env: Vec<(String, String)>,
35 pub working_dir: Option<String>,
36 pub auth_session_id: Option<String>,
37}
38
39impl SessionSpec {
40 #[must_use]
41 pub fn new(username: impl Into<String>, uid: u32, gid: u32, command: Vec<String>) -> Self {
42 Self {
43 username: username.into(),
44 uid,
45 gid,
46 command,
47 env: Vec::new(),
48 working_dir: None,
49 auth_session_id: None,
50 }
51 }
52}
53
54#[derive(Debug, Clone, PartialEq, Eq)]
56pub struct SessionHandle {
57 pub pid: u32,
58 pub username: String,
59 pub command: Vec<String>,
60 pub auth_session_id: Option<String>,
61}