rust_analyzer_modules/
options.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5use clap::Args;
6use std::path::PathBuf;
7
8#[derive(Args, Clone, PartialEq, Eq, Debug, Default)]
9pub struct GeneralOptions {
10    /// Use verbose output.
11    #[arg(long, short)]
12    pub verbose: bool,
13}
14
15#[derive(Args, Clone, PartialEq, Eq, Debug)]
16pub struct ProjectOptions {
17    /// Process only this package's library.
18    #[arg(long)]
19    pub lib: bool,
20
21    /// Process only the specified binary.
22    #[arg(long, value_name = "NAME")]
23    pub bin: Option<String>,
24
25    /// Package to process (see `cargo help pkgid`).
26    #[arg(long, short, value_name = "SPEC")]
27    pub package: Option<String>,
28
29    /// Do not activate the `default` feature.
30    #[arg(long)]
31    pub no_default_features: bool,
32
33    /// Activate all available features.
34    #[arg(long)]
35    pub all_features: bool,
36
37    /// List of features to activate.
38    /// This will be ignored if `--cargo-all-features` is provided.
39    #[arg(long, value_name = "FEATURES")]
40    pub features: Vec<String>,
41
42    /// Analyze for target triple.
43    #[arg(long, value_name = "TARGET")]
44    pub target: Option<String>,
45
46    /// Path to Cargo.toml.
47    #[arg(long, value_name = "PATH", default_value = ".")]
48    pub manifest_path: PathBuf,
49}
50
51impl Default for ProjectOptions {
52    fn default() -> Self {
53        Self {
54            lib: false,
55            bin: None,
56            package: None,
57            no_default_features: false,
58            all_features: false,
59            features: vec![],
60            target: None,
61            manifest_path: PathBuf::from("."),
62        }
63    }
64}