aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-06 20:02:06 +0000
committerAleksey Kladov <[email protected]>2021-03-07 08:12:59 +0000
commit0296cd590e4c0a21f75b7ec7b420d849c7e9588e (patch)
tree1b57a3f77193cbd62c22f65720575e5e765674cc
parent71b8fb7c572eb658ee1136f086d6348aafba1e1d (diff)
:arrow_up: xflags
-rw-r--r--Cargo.lock8
-rw-r--r--crates/rust-analyzer/Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/bin/flags.rs15
-rw-r--r--xtask/Cargo.toml2
-rw-r--r--xtask/src/flags.rs17
5 files changed, 23 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 39f27098a..c392a8907 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1919,18 +1919,18 @@ checksum = "06069a848f95fceae3e5e03c0ddc8cb78452b56654ee0c8e68f938cf790fb9e3"
1919 1919
1920[[package]] 1920[[package]]
1921name = "xflags" 1921name = "xflags"
1922version = "0.1.4" 1922version = "0.2.1"
1923source = "registry+https://github.com/rust-lang/crates.io-index" 1923source = "registry+https://github.com/rust-lang/crates.io-index"
1924checksum = "222e914b43cec5d7305ac5116d10a14b3a52c50e9062d642c92631f3beabc729" 1924checksum = "59ad6ce6a0b7224130015b4ebac796478ac04e0079f5d222a690efea06a9208a"
1925dependencies = [ 1925dependencies = [
1926 "xflags-macros", 1926 "xflags-macros",
1927] 1927]
1928 1928
1929[[package]] 1929[[package]]
1930name = "xflags-macros" 1930name = "xflags-macros"
1931version = "0.1.4" 1931version = "0.2.1"
1932source = "registry+https://github.com/rust-lang/crates.io-index" 1932source = "registry+https://github.com/rust-lang/crates.io-index"
1933checksum = "52f18f5b4aa7f95e209d5b9274f6164c3938920b4d5c75f97f0dd16daee25ddd" 1933checksum = "c8037d3ca14996158b03c0fa905d0834906ef0fc7044df72c1f5ff690e5e62c9"
1934dependencies = [ 1934dependencies = [
1935 "proc-macro2", 1935 "proc-macro2",
1936] 1936]
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 8789f0852..3130785cc 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -24,7 +24,7 @@ jod-thread = "0.1.0"
24log = "0.4.8" 24log = "0.4.8"
25lsp-types = { version = "0.88.0", features = ["proposed"] } 25lsp-types = { version = "0.88.0", features = ["proposed"] }
26parking_lot = "0.11.0" 26parking_lot = "0.11.0"
27xflags = "0.1.2" 27xflags = "0.2.1"
28oorandom = "11.1.2" 28oorandom = "11.1.2"
29rustc-hash = "1.1.0" 29rustc-hash = "1.1.0"
30serde = { version = "1.0.106", features = ["derive"] } 30serde = { version = "1.0.106", features = ["derive"] }
diff --git a/crates/rust-analyzer/src/bin/flags.rs b/crates/rust-analyzer/src/bin/flags.rs
index 244912d26..3a7caaf3f 100644
--- a/crates/rust-analyzer/src/bin/flags.rs
+++ b/crates/rust-analyzer/src/bin/flags.rs
@@ -6,7 +6,9 @@ use ide_ssr::{SsrPattern, SsrRule};
6use rust_analyzer::cli::{BenchWhat, Position, Verbosity}; 6use rust_analyzer::cli::{BenchWhat, Position, Verbosity};
7use vfs::AbsPathBuf; 7use vfs::AbsPathBuf;
8 8
9xflags::args_parser! { 9xflags::xflags! {
10 src "./src/bin/flags.rs"
11
10 /// LSP server for the Rust programming language. 12 /// LSP server for the Rust programming language.
11 cmd rust-analyzer { 13 cmd rust-analyzer {
12 /// Verbosity level, can be repeated multiple times. 14 /// Verbosity level, can be repeated multiple times.
@@ -120,7 +122,7 @@ xflags::args_parser! {
120 122
121// generated start 123// generated start
122// The following code is generated by `xflags` macro. 124// The following code is generated by `xflags` macro.
123// Run `env XFLAGS_DUMP= cargo build` to regenerate. 125// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
124#[derive(Debug)] 126#[derive(Debug)]
125pub struct RustAnalyzer { 127pub struct RustAnalyzer {
126 pub verbose: u32, 128 pub verbose: u32,
@@ -158,7 +160,7 @@ pub struct Parse {
158} 160}
159 161
160#[derive(Debug)] 162#[derive(Debug)]
161pub struct Symbols {} 163pub struct Symbols;
162 164
163#[derive(Debug)] 165#[derive(Debug)]
164pub struct Highlight { 166pub struct Highlight {
@@ -211,14 +213,13 @@ pub struct Search {
211} 213}
212 214
213#[derive(Debug)] 215#[derive(Debug)]
214pub struct ProcMacro {} 216pub struct ProcMacro;
215 217
216impl RustAnalyzer { 218impl RustAnalyzer {
217 pub const HELP: &'static str = Self::_HELP; 219 pub const HELP: &'static str = Self::HELP_;
218 220
219 pub fn from_env() -> xflags::Result<Self> { 221 pub fn from_env() -> xflags::Result<Self> {
220 let mut p = xflags::rt::Parser::new_from_env(); 222 Self::from_env_()
221 Self::_parse(&mut p)
222 } 223 }
223} 224}
224// generated end 225// generated end
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index b17dde598..e084f0df6 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -15,5 +15,5 @@ ungrammar = "=1.11"
15walkdir = "2.3.1" 15walkdir = "2.3.1"
16write-json = "0.1.0" 16write-json = "0.1.0"
17xshell = "0.1" 17xshell = "0.1"
18xflags = "0.1.2" 18xflags = "0.2.1"
19# Avoid adding more dependencies to this crate 19# Avoid adding more dependencies to this crate
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs
index 56eda5b1e..b39d937ca 100644
--- a/xtask/src/flags.rs
+++ b/xtask/src/flags.rs
@@ -2,7 +2,9 @@
2 2
3use crate::install::{ClientOpt, Malloc, ServerOpt}; 3use crate::install::{ClientOpt, Malloc, ServerOpt};
4 4
5xflags::args_parser! { 5xflags::xflags! {
6 src "./src/flags.rs"
7
6 /// Run custom build command. 8 /// Run custom build command.
7 cmd xtask { 9 cmd xtask {
8 default cmd help { 10 default cmd help {
@@ -55,7 +57,7 @@ xflags::args_parser! {
55 57
56// generated start 58// generated start
57// The following code is generated by `xflags` macro. 59// The following code is generated by `xflags` macro.
58// Run `env XFLAGS_DUMP= cargo build` to regenerate. 60// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
59#[derive(Debug)] 61#[derive(Debug)]
60pub struct Xtask { 62pub struct Xtask {
61 pub subcommand: XtaskCmd, 63 pub subcommand: XtaskCmd,
@@ -96,13 +98,13 @@ pub struct Codegen {
96} 98}
97 99
98#[derive(Debug)] 100#[derive(Debug)]
99pub struct Lint {} 101pub struct Lint;
100 102
101#[derive(Debug)] 103#[derive(Debug)]
102pub struct FuzzTests {} 104pub struct FuzzTests;
103 105
104#[derive(Debug)] 106#[derive(Debug)]
105pub struct PreCache {} 107pub struct PreCache;
106 108
107#[derive(Debug)] 109#[derive(Debug)]
108pub struct Release { 110pub struct Release {
@@ -131,11 +133,10 @@ pub struct Bb {
131} 133}
132 134
133impl Xtask { 135impl Xtask {
134 pub const HELP: &'static str = Self::_HELP; 136 pub const HELP: &'static str = Self::HELP_;
135 137
136 pub fn from_env() -> xflags::Result<Self> { 138 pub fn from_env() -> xflags::Result<Self> {
137 let mut p = xflags::rt::Parser::new_from_env(); 139 Self::from_env_()
138 Self::_parse(&mut p)
139 } 140 }
140} 141}
141// generated end 142// generated end