-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathflags.rs
More file actions
95 lines (81 loc) · 2.22 KB
/
flags.rs
File metadata and controls
95 lines (81 loc) · 2.22 KB
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
#![allow(unreachable_pub)]
use crate::install::ClientOpt;
xflags::xflags! {
src "./src/flags.rs"
/// Run custom build command.
cmd xtask {
/// Install postgres_lsp server or editor plugin.
cmd install {
/// Install only VS Code plugin.
optional --client
/// One of 'code', 'code-exploration', 'code-insiders', 'codium', or 'code-oss'.
optional --code-bin name: String
/// Install only the language server.
optional --server
}
/// Run a simple macOS leak check against an isolated language server process.
cmd leak-check {
/// Number of open/change/close LSP cycles to run.
optional --iterations n: usize
/// Pause between cycles in milliseconds.
optional --pause-ms n: u64
/// Probe to run: lsp | cli-timeout | both
optional --probe name: String
}
}
}
// generated start
// The following code is generated by `xflags` macro.
// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
#[derive(Debug)]
pub struct Xtask {
pub subcommand: XtaskCmd,
}
#[derive(Debug)]
pub enum XtaskCmd {
Install(Install),
LeakCheck(LeakCheck),
}
#[derive(Debug)]
pub struct Install {
pub client: bool,
pub code_bin: Option<String>,
pub server: bool,
}
#[derive(Debug)]
pub struct LeakCheck {
pub iterations: Option<usize>,
pub pause_ms: Option<u64>,
pub probe: Option<String>,
}
impl Xtask {
#[allow(dead_code)]
pub fn from_env_or_exit() -> Self {
Self::from_env_or_exit_()
}
#[allow(dead_code)]
pub fn from_env() -> xflags::Result<Self> {
Self::from_env_()
}
#[allow(dead_code)]
pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
Self::from_vec_(args)
}
}
// generated end
impl Install {
pub(crate) fn server(&self) -> Option<()> {
if self.client && !self.server {
return None;
}
Some(())
}
pub(crate) fn client(&self) -> Option<ClientOpt> {
if !self.client && self.server {
return None;
}
Some(ClientOpt {
code_bin: self.code_bin.clone(),
})
}
}