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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
use clap::{Arg, ArgMatches, Command, Error};
pub fn build_cli() -> Result<ArgMatches, Error> {
let matches = Command::new("My Library")
.author("Your Name")
.about(
"A Rust library generator that helps create high-quality Rust libraries quickly and easily.",
)
.arg(
Arg::new("author")
.default_value("Me")
.help("Sets the author of the library")
.long("author")
.short('a')
.value_name("AUTHOR"),
)
.arg(
Arg::new("build")
.default_value("build.rs")
.help("Sets the build script that is used to perform additional build-time operations.")
.long("build")
.short('b')
.value_name("BUILD"),
)
.arg(
Arg::new("categories")
.default_value("['category 1', 'category 2']")
.help("Sets the categories of the library")
.long("categories")
.short('c')
.value_name("CATEGORIES"),
)
.arg(
Arg::new("csv")
.default_value("")
.help("Generates a project from a CSV file")
.long("csv")
.short('f')
.value_name("CSV"),
)
.arg(
Arg::new("description")
.default_value("A library for doing things")
.help("Sets the description of the library")
.long("description")
.short('d')
.value_name("DESCRIPTION"),
)
.arg(
Arg::new("documentation")
.default_value("https://lib.rs/crates/my_library")
.help("Sets the documentation URL of the library")
.long("documentation")
.short('u')
.value_name("DOCUMENTATION"),
)
.arg(
Arg::new("edition")
.default_value("2021")
.help("Sets the edition of the library")
.long("edition")
.short('e')
.value_name("EDITION"),
)
.arg(
Arg::new("email")
.default_value("test@test.com")
.help("Sets the email of the library author")
.long("email")
.short('@')
.value_name("EMAIL"),
)
.arg(
Arg::new("homepage")
.default_value("https://test.com")
.help("Sets the homepage of the library")
.long("homepage")
.short('p')
.value_name("HOMEPAGE"),
)
.arg(
Arg::new("keywords")
.default_value("['keyword1', 'keyword2']")
.help("Sets the keywords of the library")
.long("keywords")
.short('k')
.value_name("KEYWORDS"),
)
.arg(
Arg::new("license")
.default_value("MIT OR Apache-2.0")
.short('l')
.long("license")
.value_name("LICENSE")
.help("Sets the license of the library"),
)
.arg(
Arg::new("name")
.default_value("my_library")
.help("Sets the name of the library")
.long("name")
.short('n')
.value_name("NAME"),
)
.arg(
Arg::new("output")
.default_value("my_library")
.help("Sets the output directory for the library")
.long("output")
.short('o')
.value_name("OUTPUT"),
)
.arg(
Arg::new("readme")
.default_value("README.md")
.help("Sets the README file for the library")
.long("readme")
.short('m')
.value_name("README"),
)
.arg(
Arg::new("repository")
.default_value("https://github.com/test/test")
.help("Sets the GitHub repository of the library")
.long("repository")
.short('g')
.value_name("REPOSITORY"),
)
.arg(
Arg::new("rustversion")
.default_value("1.67.1")
.help("Sets the Rust version of the library")
.long("rustversion")
.short('r')
.value_name("RUSTVERSION"),
)
.arg(
Arg::new("version")
.default_value("0.0.5")
.help("Sets the version of the library")
.long("version")
.short('v')
.value_name("VERSION"),
)
.arg(
Arg::new("website")
.default_value("https://test.com")
.help("Sets the website of the library author")
.long("website")
.short('w')
.value_name("WEBSITE"),
)
.after_help(
"Longer explanation to appear after the options when \
displaying the help information from --help or -h",
)
.get_matches();
Ok(matches)
}