⬆️ xflags

This commit is contained in:
Aleksey Kladov 2021-03-06 23:02:06 +03:00
parent 71b8fb7c57
commit 0296cd590e
5 changed files with 23 additions and 21 deletions

8
Cargo.lock generated
View File

@ -1919,18 +1919,18 @@ checksum = "06069a848f95fceae3e5e03c0ddc8cb78452b56654ee0c8e68f938cf790fb9e3"
[[package]]
name = "xflags"
version = "0.1.4"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222e914b43cec5d7305ac5116d10a14b3a52c50e9062d642c92631f3beabc729"
checksum = "59ad6ce6a0b7224130015b4ebac796478ac04e0079f5d222a690efea06a9208a"
dependencies = [
"xflags-macros",
]
[[package]]
name = "xflags-macros"
version = "0.1.4"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52f18f5b4aa7f95e209d5b9274f6164c3938920b4d5c75f97f0dd16daee25ddd"
checksum = "c8037d3ca14996158b03c0fa905d0834906ef0fc7044df72c1f5ff690e5e62c9"
dependencies = [
"proc-macro2",
]

View File

@ -24,7 +24,7 @@ jod-thread = "0.1.0"
log = "0.4.8"
lsp-types = { version = "0.88.0", features = ["proposed"] }
parking_lot = "0.11.0"
xflags = "0.1.2"
xflags = "0.2.1"
oorandom = "11.1.2"
rustc-hash = "1.1.0"
serde = { version = "1.0.106", features = ["derive"] }

View File

@ -6,7 +6,9 @@
use rust_analyzer::cli::{BenchWhat, Position, Verbosity};
use vfs::AbsPathBuf;
xflags::args_parser! {
xflags::xflags! {
src "./src/bin/flags.rs"
/// LSP server for the Rust programming language.
cmd rust-analyzer {
/// Verbosity level, can be repeated multiple times.
@ -120,7 +122,7 @@
// generated start
// The following code is generated by `xflags` macro.
// Run `env XFLAGS_DUMP= cargo build` to regenerate.
// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
#[derive(Debug)]
pub struct RustAnalyzer {
pub verbose: u32,
@ -158,7 +160,7 @@ pub struct Parse {
}
#[derive(Debug)]
pub struct Symbols {}
pub struct Symbols;
#[derive(Debug)]
pub struct Highlight {
@ -211,14 +213,13 @@ pub struct Search {
}
#[derive(Debug)]
pub struct ProcMacro {}
pub struct ProcMacro;
impl RustAnalyzer {
pub const HELP: &'static str = Self::_HELP;
pub const HELP: &'static str = Self::HELP_;
pub fn from_env() -> xflags::Result<Self> {
let mut p = xflags::rt::Parser::new_from_env();
Self::_parse(&mut p)
Self::from_env_()
}
}
// generated end

View File

@ -15,5 +15,5 @@ ungrammar = "=1.11"
walkdir = "2.3.1"
write-json = "0.1.0"
xshell = "0.1"
xflags = "0.1.2"
xflags = "0.2.1"
# Avoid adding more dependencies to this crate

View File

@ -2,7 +2,9 @@
use crate::install::{ClientOpt, Malloc, ServerOpt};
xflags::args_parser! {
xflags::xflags! {
src "./src/flags.rs"
/// Run custom build command.
cmd xtask {
default cmd help {
@ -55,7 +57,7 @@
// generated start
// The following code is generated by `xflags` macro.
// Run `env XFLAGS_DUMP= cargo build` to regenerate.
// Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
#[derive(Debug)]
pub struct Xtask {
pub subcommand: XtaskCmd,
@ -96,13 +98,13 @@ pub struct Codegen {
}
#[derive(Debug)]
pub struct Lint {}
pub struct Lint;
#[derive(Debug)]
pub struct FuzzTests {}
pub struct FuzzTests;
#[derive(Debug)]
pub struct PreCache {}
pub struct PreCache;
#[derive(Debug)]
pub struct Release {
@ -131,11 +133,10 @@ pub struct Bb {
}
impl Xtask {
pub const HELP: &'static str = Self::_HELP;
pub const HELP: &'static str = Self::HELP_;
pub fn from_env() -> xflags::Result<Self> {
let mut p = xflags::rt::Parser::new_from_env();
Self::_parse(&mut p)
Self::from_env_()
}
}
// generated end