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