1 | [workspace] |
2 | resolver = "2" |
3 | members = [ |
4 | "clap_bench" , |
5 | "clap_builder" , |
6 | "clap_derive" , |
7 | "clap_lex" , |
8 | "clap_complete" , |
9 | "clap_complete_fig" , |
10 | "clap_complete_nushell" , |
11 | "clap_mangen" , |
12 | ] |
13 | |
14 | [workspace.package] |
15 | license = "MIT OR Apache-2.0" |
16 | edition = "2021" |
17 | rust-version = "1.70.0" # MSRV |
18 | include = [ |
19 | "build.rs" , |
20 | "src/**/*" , |
21 | "Cargo.toml" , |
22 | "LICENSE*" , |
23 | "README.md" , |
24 | "benches/**/*" , |
25 | "examples/**/*" |
26 | ] |
27 | |
28 | [package] |
29 | name = "clap" |
30 | version = "4.4.18" |
31 | description = "A simple to use, efficient, and full-featured Command Line Argument Parser" |
32 | repository = "https://github.com/clap-rs/clap" |
33 | categories = ["command-line-interface" ] |
34 | keywords = [ |
35 | "argument" , |
36 | "cli" , |
37 | "arg" , |
38 | "parser" , |
39 | "parse" |
40 | ] |
41 | license.workspace = true |
42 | edition.workspace = true |
43 | rust-version.workspace = true |
44 | include.workspace = true |
45 | |
46 | [package.metadata.docs.rs] |
47 | features = ["unstable-doc" ] |
48 | rustdoc-args = ["--cfg" , "docsrs" , "--generate-link-to-definition" ] |
49 | cargo-args = ["-Zunstable-options" , "-Zrustdoc-scrape-examples" ] |
50 | |
51 | [package.metadata.playground] |
52 | features = ["unstable-doc" ] |
53 | |
54 | [package.metadata.release] |
55 | shared-version = true |
56 | tag-name = "v{{version}}" |
57 | pre-release-replacements = [ |
58 | {file="CHANGELOG.md" , search="Unreleased" , replace="{{version}}" , min=1}, |
59 | {file="CHANGELOG.md" , search="\\.\\.\\.HEAD" , replace="...{{tag_name}}" , exactly=1}, |
60 | {file="CHANGELOG.md" , search="ReleaseDate" , replace="{{date}}" , min=1}, |
61 | {file="CHANGELOG.md" , search="<!-- next-header -->" , replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n" , exactly=1}, |
62 | {file="CHANGELOG.md" , search="<!-- next-url -->" , replace="<!-- next-url -->\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD" , exactly=1}, |
63 | {file="CITATION.cff" , search="^date-released: ....-..-.." , replace="date-released: {{date}}" }, |
64 | {file="CITATION.cff" , search="^version: .+\\..+\\..+" , replace="version: {{version}}" }, |
65 | {file="src/lib.rs" , search="blob/v.+\\..+\\..+/CHANGELOG.md" , replace="blob/v{{version}}/CHANGELOG.md" , exactly=1}, |
66 | ] |
67 | |
68 | [features] |
69 | default = [ |
70 | "std" , |
71 | "color" , |
72 | "help" , |
73 | "usage" , |
74 | "error-context" , |
75 | "suggestions" , |
76 | ] |
77 | debug = ["clap_builder/debug" , "clap_derive?/debug" ] # Enables debug messages |
78 | unstable-doc = ["clap_builder/unstable-doc" , "derive" ] # for docs.rs |
79 | |
80 | # Used in default |
81 | std = ["clap_builder/std" ] # support for no_std in a backwards-compatible way |
82 | color = ["clap_builder/color" ] |
83 | help = ["clap_builder/help" ] |
84 | usage = ["clap_builder/usage" ] |
85 | error-context = ["clap_builder/error-context" ] |
86 | suggestions = ["clap_builder/suggestions" ] |
87 | |
88 | # Optional |
89 | deprecated = ["clap_builder/deprecated" , "clap_derive?/deprecated" ] # Guided experience to prepare for next breaking release (at different stages of development, this may become default) |
90 | derive = ["dep:clap_derive" ] |
91 | cargo = ["clap_builder/cargo" ] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros |
92 | wrap_help = ["clap_builder/wrap_help" ] |
93 | env = ["clap_builder/env" ] # Use environment variables during arg parsing |
94 | unicode = ["clap_builder/unicode" ] # Support for unicode characters in arguments and help messages |
95 | string = ["clap_builder/string" ] # Allow runtime generated strings |
96 | |
97 | # In-work features |
98 | unstable-v5 = ["clap_builder/unstable-v5" , "clap_derive?/unstable-v5" , "deprecated" ] |
99 | unstable-styles = ["clap_builder/unstable-styles" ] |
100 | |
101 | [lib] |
102 | bench = false |
103 | |
104 | [dependencies] |
105 | clap_builder = { path = "./clap_builder" , version = "=4.4.18" , default-features = false } |
106 | clap_derive = { path = "./clap_derive" , version = "=4.4.7" , optional = true } |
107 | |
108 | [dev-dependencies] |
109 | trybuild = "1.0.86" |
110 | rustversion = "1.0.14" |
111 | # Cutting out `filesystem` feature |
112 | trycmd = { version = "0.14.19" , default-features = false, features = ["color-auto" , "diff" , "examples" ] } |
113 | humantime = "2.1.0" |
114 | snapbox = "0.4.15" |
115 | shlex = "1.2.0" |
116 | |
117 | [[example]] |
118 | name = "demo" |
119 | required-features = ["derive" ] |
120 | |
121 | [[example]] |
122 | name = "cargo-example" |
123 | required-features = ["cargo" ] |
124 | |
125 | [[example]] |
126 | name = "cargo-example-derive" |
127 | required-features = ["derive" ] |
128 | |
129 | [[example]] |
130 | name = "escaped-positional" |
131 | required-features = ["cargo" ] |
132 | |
133 | [[example]] |
134 | name = "escaped-positional-derive" |
135 | required-features = ["derive" ] |
136 | |
137 | [[example]] |
138 | name = "find" |
139 | required-features = ["cargo" ] |
140 | |
141 | [[example]] |
142 | name = "git-derive" |
143 | required-features = ["derive" ] |
144 | |
145 | [[example]] |
146 | name = "typed-derive" |
147 | required-features = ["derive" ] |
148 | |
149 | [[example]] |
150 | name = "busybox" |
151 | path = "examples/multicall-busybox.rs" |
152 | |
153 | [[example]] |
154 | name = "hostname" |
155 | path = "examples/multicall-hostname.rs" |
156 | |
157 | [[example]] |
158 | name = "repl" |
159 | path = "examples/repl.rs" |
160 | required-features = ["help" ] |
161 | |
162 | [[example]] |
163 | name = "01_quick" |
164 | path = "examples/tutorial_builder/01_quick.rs" |
165 | required-features = ["cargo" ] |
166 | |
167 | [[example]] |
168 | name = "02_apps" |
169 | path = "examples/tutorial_builder/02_apps.rs" |
170 | |
171 | [[example]] |
172 | name = "02_crate" |
173 | path = "examples/tutorial_builder/02_crate.rs" |
174 | required-features = ["cargo" ] |
175 | |
176 | [[example]] |
177 | name = "02_app_settings" |
178 | path = "examples/tutorial_builder/02_app_settings.rs" |
179 | required-features = ["cargo" ] |
180 | |
181 | [[example]] |
182 | name = "03_01_flag_bool" |
183 | path = "examples/tutorial_builder/03_01_flag_bool.rs" |
184 | required-features = ["cargo" ] |
185 | |
186 | [[example]] |
187 | name = "03_01_flag_count" |
188 | path = "examples/tutorial_builder/03_01_flag_count.rs" |
189 | required-features = ["cargo" ] |
190 | |
191 | [[example]] |
192 | name = "03_02_option" |
193 | path = "examples/tutorial_builder/03_02_option.rs" |
194 | required-features = ["cargo" ] |
195 | |
196 | [[example]] |
197 | name = "03_02_option_mult" |
198 | path = "examples/tutorial_builder/03_02_option_mult.rs" |
199 | required-features = ["cargo" ] |
200 | |
201 | [[example]] |
202 | name = "03_03_positional" |
203 | path = "examples/tutorial_builder/03_03_positional.rs" |
204 | required-features = ["cargo" ] |
205 | |
206 | [[example]] |
207 | name = "03_03_positional_mult" |
208 | path = "examples/tutorial_builder/03_03_positional_mult.rs" |
209 | required-features = ["cargo" ] |
210 | |
211 | [[example]] |
212 | name = "03_04_subcommands" |
213 | path = "examples/tutorial_builder/03_04_subcommands.rs" |
214 | required-features = ["cargo" ] |
215 | |
216 | [[example]] |
217 | name = "03_05_default_values" |
218 | path = "examples/tutorial_builder/03_05_default_values.rs" |
219 | required-features = ["cargo" ] |
220 | |
221 | [[example]] |
222 | name = "04_01_possible" |
223 | path = "examples/tutorial_builder/04_01_possible.rs" |
224 | required-features = ["cargo" ] |
225 | |
226 | [[example]] |
227 | name = "04_01_enum" |
228 | path = "examples/tutorial_builder/04_01_enum.rs" |
229 | required-features = ["cargo" ] |
230 | |
231 | [[example]] |
232 | name = "04_02_parse" |
233 | path = "examples/tutorial_builder/04_02_parse.rs" |
234 | required-features = ["cargo" ] |
235 | |
236 | [[example]] |
237 | name = "04_02_validate" |
238 | path = "examples/tutorial_builder/04_02_validate.rs" |
239 | required-features = ["cargo" ] |
240 | |
241 | [[example]] |
242 | name = "04_03_relations" |
243 | path = "examples/tutorial_builder/04_03_relations.rs" |
244 | required-features = ["cargo" ] |
245 | |
246 | [[example]] |
247 | name = "04_04_custom" |
248 | path = "examples/tutorial_builder/04_04_custom.rs" |
249 | required-features = ["cargo" ] |
250 | |
251 | [[example]] |
252 | name = "05_01_assert" |
253 | path = "examples/tutorial_builder/05_01_assert.rs" |
254 | required-features = ["cargo" ] |
255 | test = true |
256 | |
257 | [[example]] |
258 | name = "01_quick_derive" |
259 | path = "examples/tutorial_derive/01_quick.rs" |
260 | required-features = ["derive" ] |
261 | |
262 | [[example]] |
263 | name = "02_apps_derive" |
264 | path = "examples/tutorial_derive/02_apps.rs" |
265 | required-features = ["derive" ] |
266 | |
267 | [[example]] |
268 | name = "02_crate_derive" |
269 | path = "examples/tutorial_derive/02_crate.rs" |
270 | required-features = ["derive" ] |
271 | |
272 | [[example]] |
273 | name = "02_app_settings_derive" |
274 | path = "examples/tutorial_derive/02_app_settings.rs" |
275 | required-features = ["derive" ] |
276 | |
277 | [[example]] |
278 | name = "03_01_flag_bool_derive" |
279 | path = "examples/tutorial_derive/03_01_flag_bool.rs" |
280 | required-features = ["derive" ] |
281 | |
282 | [[example]] |
283 | name = "03_01_flag_count_derive" |
284 | path = "examples/tutorial_derive/03_01_flag_count.rs" |
285 | required-features = ["derive" ] |
286 | |
287 | [[example]] |
288 | name = "03_02_option_derive" |
289 | path = "examples/tutorial_derive/03_02_option.rs" |
290 | required-features = ["derive" ] |
291 | |
292 | [[example]] |
293 | name = "03_02_option_mult_derive" |
294 | path = "examples/tutorial_derive/03_02_option_mult.rs" |
295 | required-features = ["derive" ] |
296 | |
297 | [[example]] |
298 | name = "03_03_positional_derive" |
299 | path = "examples/tutorial_derive/03_03_positional.rs" |
300 | required-features = ["derive" ] |
301 | |
302 | [[example]] |
303 | name = "03_03_positional_mult_derive" |
304 | path = "examples/tutorial_derive/03_03_positional_mult.rs" |
305 | required-features = ["derive" ] |
306 | |
307 | [[example]] |
308 | name = "03_04_subcommands_derive" |
309 | path = "examples/tutorial_derive/03_04_subcommands.rs" |
310 | required-features = ["derive" ] |
311 | |
312 | [[example]] |
313 | name = "03_04_subcommands_alt_derive" |
314 | path = "examples/tutorial_derive/03_04_subcommands_alt.rs" |
315 | required-features = ["derive" ] |
316 | |
317 | [[example]] |
318 | name = "03_05_default_values_derive" |
319 | path = "examples/tutorial_derive/03_05_default_values.rs" |
320 | required-features = ["derive" ] |
321 | |
322 | [[example]] |
323 | name = "04_01_enum_derive" |
324 | path = "examples/tutorial_derive/04_01_enum.rs" |
325 | required-features = ["derive" ] |
326 | |
327 | [[example]] |
328 | name = "04_02_parse_derive" |
329 | path = "examples/tutorial_derive/04_02_parse.rs" |
330 | required-features = ["derive" ] |
331 | |
332 | [[example]] |
333 | name = "04_02_validate_derive" |
334 | path = "examples/tutorial_derive/04_02_validate.rs" |
335 | required-features = ["derive" ] |
336 | |
337 | [[example]] |
338 | name = "04_03_relations_derive" |
339 | path = "examples/tutorial_derive/04_03_relations.rs" |
340 | required-features = ["derive" ] |
341 | |
342 | [[example]] |
343 | name = "04_04_custom_derive" |
344 | path = "examples/tutorial_derive/04_04_custom.rs" |
345 | required-features = ["derive" ] |
346 | |
347 | [[example]] |
348 | name = "05_01_assert_derive" |
349 | path = "examples/tutorial_derive/05_01_assert.rs" |
350 | required-features = ["derive" ] |
351 | test = true |
352 | |
353 | [[example]] |
354 | name = "interop_augment_args" |
355 | path = "examples/derive_ref/augment_args.rs" |
356 | required-features = ["derive" ] |
357 | |
358 | [[example]] |
359 | name = "interop_augment_subcommands" |
360 | path = "examples/derive_ref/augment_subcommands.rs" |
361 | required-features = ["derive" ] |
362 | |
363 | [[example]] |
364 | name = "interop_hand_subcommand" |
365 | path = "examples/derive_ref/hand_subcommand.rs" |
366 | required-features = ["derive" ] |
367 | |
368 | [[example]] |
369 | name = "interop_flatten_hand_args" |
370 | path = "examples/derive_ref/flatten_hand_args.rs" |
371 | required-features = ["derive" ] |
372 | |
373 | [profile.test] |
374 | opt-level = 1 |
375 | |
376 | [profile.bench] |
377 | lto = true |
378 | codegen-units = 1 |
379 | |