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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use std::path::PathBuf;
use clap::Parser;
use clap::ValueEnum;
#[derive(Parser, Debug, Default)]
#[command(version, about, long_about = None)]
pub struct Cli {
/// Whether to start or stop the terrazzo-terminal daemon.
#[arg(long, short, value_enum, default_value_t = Action::Run)]
pub action: Action,
/// Read the password for `set-password` from stdin instead of prompting.
#[arg(long)]
pub password_stdin: bool,
/// The TCP host to listen to.
#[arg(long)]
pub host: Option<String>,
/// The file to store the config.
#[arg(long)]
pub config_file: Option<PathBuf>,
/// The TCP port to listen to.
#[arg(long)]
pub port: Option<u16>,
/// Additional TCP ports to listen to.
#[arg(long)]
pub ports: Vec<u16>,
/// The shell command to run for new terminals.
#[arg(long)]
pub terminal_shell: Option<String>,
/// The folder where deleted text-editor files are moved.
#[arg(long)]
pub trash: Option<PathBuf>,
/// The folder, relative to a Git repository root, where deleted Git files are moved.
#[arg(long)]
pub git_trash: Option<PathBuf>,
/// A temp file to write the port allocated dynamically.
#[arg(long)]
pub set_current_endpoint: Option<PathBuf>,
/// The file to store the pid of the daemon while it is running.
#[arg(long)]
pub pidfile: Option<PathBuf>,
/// The file to the store private Root CA.
#[arg(long)]
pub private_root_ca: Option<PathBuf>,
/// If using mesh: the Client name.
#[arg(long)]
pub client_name: Option<String>,
/// If using mesh: the Gateway endpoint
#[arg(long)]
pub gateway_url: Option<String>,
/// If using mesh: the Gateway CA
#[arg(long)]
pub gateway_pki: Option<PathBuf>,
/// If using mesh: the AuthCode to get a client certificate
#[arg(long, default_value_t = String::default())]
pub auth_code: String,
/// If using mesh: the file to store the client certificate
#[arg(long)]
pub client_certificate: Option<PathBuf>,
}
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum Action {
/// Run the server in the foreground
#[default]
Run,
/// Run the server in the background as a daemon
Start,
/// Stop the daemon
Stop,
/// Restart the daemon
Restart,
/// Sets the password
SetPassword,
/// Lists all installed asset source paths
#[cfg(feature = "debug")]
ListAssets,
}