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