Debian Codegraph @

Xtree-house/cli/src/flags.rs

raw symbols SCIP
1 use std::path::PathBuf;
2
3 xflags::xflags! {
4 src "./src/flags.rs"
5
6 cmd skidder {
7 cmd import {
8 /// Whether to import queries
9 optional --import-queries
10 /// Whether to (re)generate metadata
11 optional --metadata
12 /// The repository/directory where repos are copied into.
13 /// Defaults to the current working directory
14 optional -r,--repo repo: PathBuf
15 /// The path of the grammars to import. The name of the directory
16 /// will be used as the grammar name. To overwrite you can append
17 /// the grammar name with a colon
18 repeated path: PathBuf
19 }
20 cmd build {
21 optional --verbose
22 optional -j, --threads threads: usize
23 optional -f, --force
24 required repo: PathBuf
25 optional grammar: String
26 }
27 cmd init-repo {
28 required repo: PathBuf
29 }
30 cmd load-grammar {
31 optional -r, --recursive
32 required path: PathBuf
33 }
34 cmd regenerate-parser {
35 optional -r, --recursive
36 required path: PathBuf
37 }
38 default cmd version {
39 optional --version
40 }
41 }
42 }
43 // generated start
44 // The following code is generated by `xflags` macro.
45 // Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
46 #[derive(Debug)]
47 pub struct Skidder {
48 pub subcommand: SkidderCmd,
49 }
50
51 #[derive(Debug)]
52 pub enum SkidderCmd {
53 Version(Version),
54 Import(Import),
55 Build(Build),
56 InitRepo(InitRepo),
57 LoadGrammar(LoadGrammar),
58 RegenerateParser(RegenerateParser),
59 }
60
61 #[derive(Debug)]
62 pub struct Version {
63 pub version: bool,
64 }
65
66 #[derive(Debug)]
67 pub struct Import {
68 pub path: Vec<PathBuf>,
69
70 pub import_queries: bool,
71 pub metadata: bool,
72 pub repo: Option<PathBuf>,
73 }
74
75 #[derive(Debug)]
76 pub struct Build {
77 pub repo: PathBuf,
78 pub grammar: Option<String>,
79
80 pub verbose: bool,
81 pub threads: Option<usize>,
82 pub force: bool,
83 }
84
85 #[derive(Debug)]
86 pub struct InitRepo {
87 pub repo: PathBuf,
88 }
89
90 #[derive(Debug)]
91 pub struct LoadGrammar {
92 pub path: PathBuf,
93
94 pub recursive: bool,
95 }
96
97 #[derive(Debug)]
98 pub struct RegenerateParser {
99 pub path: PathBuf,
100
101 pub recursive: bool,
102 }
103
104 impl Skidder {
105 #[allow(dead_code)]
106 pub fn from_env_or_exit() -> Self {
107 Self::from_env_or_exit_()
108 }
109
110 #[allow(dead_code)]
111 pub fn from_env() -> xflags::Result<Self> {
112 Self::from_env_()
113 }
114
115 #[allow(dead_code)]
116 pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
117 Self::from_vec_(args)
118 }
119 }
120 // generated end
121
122 impl Skidder {
123 pub const HELP: &str = Self::HELP_;
124 }