| 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_nushell" , |
| 10 | "clap_mangen" , |
| 11 | ] |
| 12 | |
| 13 | [workspace.package] |
| 14 | repository = "https://github.com/clap-rs/clap" |
| 15 | license = "MIT OR Apache-2.0" |
| 16 | edition = "2021" |
| 17 | rust-version = "1.74" # MSRV |
| 18 | include = [ |
| 19 | "build.rs" , |
| 20 | "src/**/*" , |
| 21 | "Cargo.toml" , |
| 22 | "LICENSE*" , |
| 23 | "README.md" , |
| 24 | "benches/**/*" , |
| 25 | "examples/**/*" |
| 26 | ] |
| 27 | |
| 28 | [workspace.lints.rust] |
| 29 | rust_2018_idioms = { level = "warn" , priority = -1 } |
| 30 | unreachable_pub = "warn" |
| 31 | unsafe_op_in_unsafe_fn = "warn" |
| 32 | unused_lifetimes = "warn" |
| 33 | unused_macro_rules = "warn" |
| 34 | unused_qualifications = "warn" |
| 35 | |
| 36 | [workspace.lints.clippy] |
| 37 | bool_assert_comparison = "allow" |
| 38 | branches_sharing_code = "allow" |
| 39 | checked_conversions = "warn" |
| 40 | collapsible_else_if = "allow" |
| 41 | create_dir = "warn" |
| 42 | dbg_macro = "warn" |
| 43 | debug_assert_with_mut_call = "warn" |
| 44 | doc_markdown = "warn" |
| 45 | empty_enum = "warn" |
| 46 | enum_glob_use = "warn" |
| 47 | expl_impl_clone_on_copy = "warn" |
| 48 | explicit_deref_methods = "warn" |
| 49 | explicit_into_iter_loop = "warn" |
| 50 | fallible_impl_from = "warn" |
| 51 | filter_map_next = "warn" |
| 52 | flat_map_option = "warn" |
| 53 | float_cmp_const = "warn" |
| 54 | fn_params_excessive_bools = "warn" |
| 55 | from_iter_instead_of_collect = "warn" |
| 56 | if_same_then_else = "allow" |
| 57 | implicit_clone = "warn" |
| 58 | imprecise_flops = "warn" |
| 59 | inconsistent_struct_constructor = "warn" |
| 60 | inefficient_to_string = "warn" |
| 61 | infinite_loop = "warn" |
| 62 | invalid_upcast_comparisons = "warn" |
| 63 | large_digit_groups = "warn" |
| 64 | large_stack_arrays = "warn" |
| 65 | large_types_passed_by_value = "warn" |
| 66 | let_and_return = "allow" # sometimes good to name what you are returning |
| 67 | linkedlist = "warn" |
| 68 | lossy_float_literal = "warn" |
| 69 | macro_use_imports = "warn" |
| 70 | mem_forget = "warn" |
| 71 | mutex_integer = "warn" |
| 72 | needless_continue = "warn" |
| 73 | needless_for_each = "warn" |
| 74 | negative_feature_names = "warn" |
| 75 | path_buf_push_overwrite = "warn" |
| 76 | ptr_as_ptr = "warn" |
| 77 | rc_mutex = "warn" |
| 78 | redundant_feature_names = "warn" |
| 79 | ref_option_ref = "warn" |
| 80 | rest_pat_in_fully_bound_structs = "warn" |
| 81 | same_functions_in_if_condition = "warn" |
| 82 | self_named_module_files = "warn" |
| 83 | semicolon_if_nothing_returned = "warn" |
| 84 | # str_to_string = "warn" |
| 85 | # string_add = "warn" |
| 86 | string_add_assign = "warn" |
| 87 | string_lit_as_bytes = "warn" |
| 88 | # string_to_string = "warn" |
| 89 | todo = "warn" |
| 90 | trait_duplication_in_bounds = "warn" |
| 91 | uninlined_format_args = "warn" |
| 92 | verbose_file_reads = "warn" |
| 93 | # wildcard_imports = "warn" |
| 94 | zero_sized_map_values = "warn" |
| 95 | # Fix later: |
| 96 | multiple_bound_locations = "allow" |
| 97 | assigning_clones = "allow" |
| 98 | blocks_in_conditions = "allow" |
| 99 | |
| 100 | [package] |
| 101 | name = "clap" |
| 102 | version = "4.5.37" |
| 103 | description = "A simple to use, efficient, and full-featured Command Line Argument Parser" |
| 104 | categories = ["command-line-interface" ] |
| 105 | keywords = [ |
| 106 | "argument" , |
| 107 | "cli" , |
| 108 | "arg" , |
| 109 | "parser" , |
| 110 | "parse" |
| 111 | ] |
| 112 | repository.workspace = true |
| 113 | license.workspace = true |
| 114 | edition.workspace = true |
| 115 | rust-version.workspace = true |
| 116 | include.workspace = true |
| 117 | |
| 118 | [package.metadata.docs.rs] |
| 119 | features = ["unstable-doc" ] |
| 120 | rustdoc-args = ["--cfg" , "docsrs" , "--generate-link-to-definition" ] |
| 121 | |
| 122 | [package.metadata.playground] |
| 123 | features = ["unstable-doc" ] |
| 124 | |
| 125 | [package.metadata.release] |
| 126 | shared-version = true |
| 127 | tag-name = "v{{version}}" |
| 128 | pre-release-replacements = [ |
| 129 | {file="CHANGELOG.md" , search="Unreleased" , replace="{{version}}" , min=1}, |
| 130 | {file="CHANGELOG.md" , search="\\.\\.\\.HEAD" , replace="...{{tag_name}}" , exactly=1}, |
| 131 | {file="CHANGELOG.md" , search="ReleaseDate" , replace="{{date}}" , min=1}, |
| 132 | {file="CHANGELOG.md" , search="<!-- next-header -->" , replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n" , exactly=1}, |
| 133 | {file="CHANGELOG.md" , search="<!-- next-url -->" , replace="<!-- next-url -->\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD" , exactly=1}, |
| 134 | {file="CITATION.cff" , search="^date-released: ....-..-.." , replace="date-released: {{date}}" }, |
| 135 | {file="CITATION.cff" , search="^version: .+\\..+\\..+" , replace="version: {{version}}" }, |
| 136 | {file="src/lib.rs" , search="blob/v.+\\..+\\..+/CHANGELOG.md" , replace="blob/v{{version}}/CHANGELOG.md" , exactly=1}, |
| 137 | ] |
| 138 | |
| 139 | [features] |
| 140 | default = [ |
| 141 | "std" , |
| 142 | "color" , |
| 143 | "help" , |
| 144 | "usage" , |
| 145 | "error-context" , |
| 146 | "suggestions" , |
| 147 | ] |
| 148 | debug = ["clap_builder/debug" , "clap_derive?/debug" ] # Enables debug messages |
| 149 | unstable-doc = ["clap_builder/unstable-doc" , "derive" ] # for docs.rs |
| 150 | |
| 151 | # Used in default |
| 152 | std = ["clap_builder/std" ] # support for no_std in a backwards-compatible way |
| 153 | color = ["clap_builder/color" ] |
| 154 | help = ["clap_builder/help" ] |
| 155 | usage = ["clap_builder/usage" ] |
| 156 | error-context = ["clap_builder/error-context" ] |
| 157 | suggestions = ["clap_builder/suggestions" ] |
| 158 | |
| 159 | # Optional |
| 160 | deprecated = ["clap_builder/deprecated" , "clap_derive?/deprecated" ] # Guided experience to prepare for next breaking release (at different stages of development, this may become default) |
| 161 | derive = ["dep:clap_derive" ] |
| 162 | cargo = ["clap_builder/cargo" ] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros |
| 163 | wrap_help = ["clap_builder/wrap_help" ] |
| 164 | env = ["clap_builder/env" ] # Use environment variables during arg parsing |
| 165 | unicode = ["clap_builder/unicode" ] # Support for unicode characters in arguments and help messages |
| 166 | string = ["clap_builder/string" ] # Allow runtime generated strings |
| 167 | |
| 168 | # In-work features |
| 169 | unstable-v5 = ["clap_builder/unstable-v5" , "clap_derive?/unstable-v5" , "deprecated" ] |
| 170 | unstable-ext = ["clap_builder/unstable-ext" ] |
| 171 | unstable-styles = ["clap_builder/unstable-styles" ] # deprecated |
| 172 | unstable-derive-ui-tests = [] |
| 173 | unstable-markdown = ["clap_derive/unstable-markdown" ] |
| 174 | |
| 175 | [lib] |
| 176 | bench = false |
| 177 | |
| 178 | [dependencies] |
| 179 | clap_builder = { path = "./clap_builder" , version = "=4.5.37" , default-features = false } |
| 180 | clap_derive = { path = "./clap_derive" , version = "=4.5.32" , optional = true } |
| 181 | |
| 182 | [dev-dependencies] |
| 183 | trybuild = "1.0.91" |
| 184 | rustversion = "1.0.15" |
| 185 | # Cutting out `filesystem` feature |
| 186 | trycmd = { version = "0.15.3" , default-features = false, features = ["color-auto" , "diff" , "examples" ] } |
| 187 | jiff = "0.2.3" |
| 188 | snapbox = { version = "0.6.16" , features = ["term-svg" ] } |
| 189 | shlex = "1.3.0" |
| 190 | automod = "1.0.14" |
| 191 | clap-cargo = { version = "0.15.0" , default-features = false } |
| 192 | |
| 193 | [[example]] |
| 194 | name = "demo" |
| 195 | required-features = ["derive" ] |
| 196 | doc-scrape-examples = true |
| 197 | |
| 198 | [[example]] |
| 199 | name = "cargo-example" |
| 200 | required-features = ["cargo" , "color" ] |
| 201 | doc-scrape-examples = true |
| 202 | |
| 203 | [[example]] |
| 204 | name = "cargo-example-derive" |
| 205 | required-features = ["derive" , "color" ] |
| 206 | doc-scrape-examples = true |
| 207 | |
| 208 | [[example]] |
| 209 | name = "escaped-positional" |
| 210 | required-features = ["cargo" ] |
| 211 | doc-scrape-examples = true |
| 212 | |
| 213 | [[example]] |
| 214 | name = "escaped-positional-derive" |
| 215 | required-features = ["derive" ] |
| 216 | doc-scrape-examples = true |
| 217 | |
| 218 | [[example]] |
| 219 | name = "find" |
| 220 | required-features = ["cargo" ] |
| 221 | doc-scrape-examples = true |
| 222 | |
| 223 | [[example]] |
| 224 | name = "git-derive" |
| 225 | required-features = ["derive" ] |
| 226 | doc-scrape-examples = true |
| 227 | |
| 228 | [[example]] |
| 229 | name = "typed-derive" |
| 230 | required-features = ["derive" ] |
| 231 | doc-scrape-examples = true |
| 232 | |
| 233 | [[example]] |
| 234 | name = "busybox" |
| 235 | path = "examples/multicall-busybox.rs" |
| 236 | doc-scrape-examples = true |
| 237 | |
| 238 | [[example]] |
| 239 | name = "hostname" |
| 240 | path = "examples/multicall-hostname.rs" |
| 241 | doc-scrape-examples = true |
| 242 | |
| 243 | [[example]] |
| 244 | name = "repl" |
| 245 | path = "examples/repl.rs" |
| 246 | required-features = ["help" ] |
| 247 | doc-scrape-examples = true |
| 248 | |
| 249 | [[example]] |
| 250 | name = "repl-derive" |
| 251 | path = "examples/repl-derive.rs" |
| 252 | required-features = ["derive" ] |
| 253 | doc-scrape-examples = true |
| 254 | |
| 255 | [[example]] |
| 256 | name = "01_quick" |
| 257 | path = "examples/tutorial_builder/01_quick.rs" |
| 258 | required-features = ["cargo" ] |
| 259 | doc-scrape-examples = true |
| 260 | |
| 261 | [[example]] |
| 262 | name = "02_apps" |
| 263 | path = "examples/tutorial_builder/02_apps.rs" |
| 264 | doc-scrape-examples = true |
| 265 | |
| 266 | [[example]] |
| 267 | name = "02_crate" |
| 268 | path = "examples/tutorial_builder/02_crate.rs" |
| 269 | required-features = ["cargo" ] |
| 270 | doc-scrape-examples = true |
| 271 | |
| 272 | [[example]] |
| 273 | name = "02_app_settings" |
| 274 | path = "examples/tutorial_builder/02_app_settings.rs" |
| 275 | required-features = ["cargo" ] |
| 276 | doc-scrape-examples = true |
| 277 | |
| 278 | [[example]] |
| 279 | name = "03_01_flag_bool" |
| 280 | path = "examples/tutorial_builder/03_01_flag_bool.rs" |
| 281 | required-features = ["cargo" ] |
| 282 | doc-scrape-examples = true |
| 283 | |
| 284 | [[example]] |
| 285 | name = "03_01_flag_count" |
| 286 | path = "examples/tutorial_builder/03_01_flag_count.rs" |
| 287 | required-features = ["cargo" ] |
| 288 | doc-scrape-examples = true |
| 289 | |
| 290 | [[example]] |
| 291 | name = "03_02_option" |
| 292 | path = "examples/tutorial_builder/03_02_option.rs" |
| 293 | required-features = ["cargo" ] |
| 294 | doc-scrape-examples = true |
| 295 | |
| 296 | [[example]] |
| 297 | name = "03_02_option_mult" |
| 298 | path = "examples/tutorial_builder/03_02_option_mult.rs" |
| 299 | required-features = ["cargo" ] |
| 300 | doc-scrape-examples = true |
| 301 | |
| 302 | [[example]] |
| 303 | name = "03_03_positional" |
| 304 | path = "examples/tutorial_builder/03_03_positional.rs" |
| 305 | required-features = ["cargo" ] |
| 306 | doc-scrape-examples = true |
| 307 | |
| 308 | [[example]] |
| 309 | name = "03_03_positional_mult" |
| 310 | path = "examples/tutorial_builder/03_03_positional_mult.rs" |
| 311 | required-features = ["cargo" ] |
| 312 | doc-scrape-examples = true |
| 313 | |
| 314 | [[example]] |
| 315 | name = "03_04_subcommands" |
| 316 | path = "examples/tutorial_builder/03_04_subcommands.rs" |
| 317 | required-features = ["cargo" ] |
| 318 | doc-scrape-examples = true |
| 319 | |
| 320 | [[example]] |
| 321 | name = "03_05_default_values" |
| 322 | path = "examples/tutorial_builder/03_05_default_values.rs" |
| 323 | required-features = ["cargo" ] |
| 324 | doc-scrape-examples = true |
| 325 | |
| 326 | [[example]] |
| 327 | name = "03_06_required" |
| 328 | path = "examples/tutorial_builder/03_06_required.rs" |
| 329 | required-features = ["cargo" ] |
| 330 | doc-scrape-examples = true |
| 331 | |
| 332 | [[example]] |
| 333 | name = "04_01_possible" |
| 334 | path = "examples/tutorial_builder/04_01_possible.rs" |
| 335 | required-features = ["cargo" ] |
| 336 | doc-scrape-examples = true |
| 337 | |
| 338 | [[example]] |
| 339 | name = "04_01_enum" |
| 340 | path = "examples/tutorial_builder/04_01_enum.rs" |
| 341 | required-features = ["cargo" ] |
| 342 | doc-scrape-examples = true |
| 343 | |
| 344 | [[example]] |
| 345 | name = "04_02_parse" |
| 346 | path = "examples/tutorial_builder/04_02_parse.rs" |
| 347 | required-features = ["cargo" ] |
| 348 | doc-scrape-examples = true |
| 349 | |
| 350 | [[example]] |
| 351 | name = "04_02_validate" |
| 352 | path = "examples/tutorial_builder/04_02_validate.rs" |
| 353 | required-features = ["cargo" ] |
| 354 | doc-scrape-examples = true |
| 355 | |
| 356 | [[example]] |
| 357 | name = "04_03_relations" |
| 358 | path = "examples/tutorial_builder/04_03_relations.rs" |
| 359 | required-features = ["cargo" ] |
| 360 | doc-scrape-examples = true |
| 361 | |
| 362 | [[example]] |
| 363 | name = "04_04_custom" |
| 364 | path = "examples/tutorial_builder/04_04_custom.rs" |
| 365 | required-features = ["cargo" ] |
| 366 | doc-scrape-examples = true |
| 367 | |
| 368 | [[example]] |
| 369 | name = "05_01_assert" |
| 370 | path = "examples/tutorial_builder/05_01_assert.rs" |
| 371 | required-features = ["cargo" ] |
| 372 | test = true |
| 373 | doc-scrape-examples = true |
| 374 | |
| 375 | [[example]] |
| 376 | name = "01_quick_derive" |
| 377 | path = "examples/tutorial_derive/01_quick.rs" |
| 378 | required-features = ["derive" ] |
| 379 | doc-scrape-examples = true |
| 380 | |
| 381 | [[example]] |
| 382 | name = "02_apps_derive" |
| 383 | path = "examples/tutorial_derive/02_apps.rs" |
| 384 | required-features = ["derive" ] |
| 385 | doc-scrape-examples = true |
| 386 | |
| 387 | [[example]] |
| 388 | name = "02_crate_derive" |
| 389 | path = "examples/tutorial_derive/02_crate.rs" |
| 390 | required-features = ["derive" ] |
| 391 | doc-scrape-examples = true |
| 392 | |
| 393 | [[example]] |
| 394 | name = "02_app_settings_derive" |
| 395 | path = "examples/tutorial_derive/02_app_settings.rs" |
| 396 | required-features = ["derive" ] |
| 397 | doc-scrape-examples = true |
| 398 | |
| 399 | [[example]] |
| 400 | name = "03_01_flag_bool_derive" |
| 401 | path = "examples/tutorial_derive/03_01_flag_bool.rs" |
| 402 | required-features = ["derive" ] |
| 403 | doc-scrape-examples = true |
| 404 | |
| 405 | [[example]] |
| 406 | name = "03_01_flag_count_derive" |
| 407 | path = "examples/tutorial_derive/03_01_flag_count.rs" |
| 408 | required-features = ["derive" ] |
| 409 | doc-scrape-examples = true |
| 410 | |
| 411 | [[example]] |
| 412 | name = "03_02_option_derive" |
| 413 | path = "examples/tutorial_derive/03_02_option.rs" |
| 414 | required-features = ["derive" ] |
| 415 | doc-scrape-examples = true |
| 416 | |
| 417 | [[example]] |
| 418 | name = "03_02_option_mult_derive" |
| 419 | path = "examples/tutorial_derive/03_02_option_mult.rs" |
| 420 | required-features = ["derive" ] |
| 421 | doc-scrape-examples = true |
| 422 | |
| 423 | [[example]] |
| 424 | name = "03_03_positional_derive" |
| 425 | path = "examples/tutorial_derive/03_03_positional.rs" |
| 426 | required-features = ["derive" ] |
| 427 | doc-scrape-examples = true |
| 428 | |
| 429 | [[example]] |
| 430 | name = "03_03_positional_mult_derive" |
| 431 | path = "examples/tutorial_derive/03_03_positional_mult.rs" |
| 432 | required-features = ["derive" ] |
| 433 | doc-scrape-examples = true |
| 434 | |
| 435 | [[example]] |
| 436 | name = "03_04_subcommands_derive" |
| 437 | path = "examples/tutorial_derive/03_04_subcommands.rs" |
| 438 | required-features = ["derive" ] |
| 439 | doc-scrape-examples = true |
| 440 | |
| 441 | [[example]] |
| 442 | name = "03_04_subcommands_alt_derive" |
| 443 | path = "examples/tutorial_derive/03_04_subcommands_alt.rs" |
| 444 | required-features = ["derive" ] |
| 445 | doc-scrape-examples = true |
| 446 | |
| 447 | [[example]] |
| 448 | name = "03_05_default_values_derive" |
| 449 | path = "examples/tutorial_derive/03_05_default_values.rs" |
| 450 | required-features = ["derive" ] |
| 451 | doc-scrape-examples = true |
| 452 | |
| 453 | [[example]] |
| 454 | name = "03_06_optional_derive" |
| 455 | path = "examples/tutorial_derive/03_06_optional.rs" |
| 456 | required-features = ["derive" ] |
| 457 | doc-scrape-examples = true |
| 458 | |
| 459 | [[example]] |
| 460 | name = "04_01_enum_derive" |
| 461 | path = "examples/tutorial_derive/04_01_enum.rs" |
| 462 | required-features = ["derive" ] |
| 463 | doc-scrape-examples = true |
| 464 | |
| 465 | [[example]] |
| 466 | name = "04_02_parse_derive" |
| 467 | path = "examples/tutorial_derive/04_02_parse.rs" |
| 468 | required-features = ["derive" ] |
| 469 | doc-scrape-examples = true |
| 470 | |
| 471 | [[example]] |
| 472 | name = "04_02_validate_derive" |
| 473 | path = "examples/tutorial_derive/04_02_validate.rs" |
| 474 | required-features = ["derive" ] |
| 475 | doc-scrape-examples = true |
| 476 | |
| 477 | [[example]] |
| 478 | name = "04_03_relations_derive" |
| 479 | path = "examples/tutorial_derive/04_03_relations.rs" |
| 480 | required-features = ["derive" ] |
| 481 | doc-scrape-examples = true |
| 482 | |
| 483 | [[example]] |
| 484 | name = "04_04_custom_derive" |
| 485 | path = "examples/tutorial_derive/04_04_custom.rs" |
| 486 | required-features = ["derive" ] |
| 487 | doc-scrape-examples = true |
| 488 | |
| 489 | [[example]] |
| 490 | name = "05_01_assert_derive" |
| 491 | path = "examples/tutorial_derive/05_01_assert.rs" |
| 492 | required-features = ["derive" ] |
| 493 | test = true |
| 494 | doc-scrape-examples = true |
| 495 | |
| 496 | [[example]] |
| 497 | name = "interop_augment_args" |
| 498 | path = "examples/derive_ref/augment_args.rs" |
| 499 | required-features = ["derive" ] |
| 500 | doc-scrape-examples = true |
| 501 | |
| 502 | [[example]] |
| 503 | name = "interop_augment_subcommands" |
| 504 | path = "examples/derive_ref/augment_subcommands.rs" |
| 505 | required-features = ["derive" ] |
| 506 | doc-scrape-examples = true |
| 507 | |
| 508 | [[example]] |
| 509 | name = "interop_hand_subcommand" |
| 510 | path = "examples/derive_ref/hand_subcommand.rs" |
| 511 | required-features = ["derive" ] |
| 512 | doc-scrape-examples = true |
| 513 | |
| 514 | [[example]] |
| 515 | name = "interop_flatten_hand_args" |
| 516 | path = "examples/derive_ref/flatten_hand_args.rs" |
| 517 | required-features = ["derive" ] |
| 518 | doc-scrape-examples = true |
| 519 | |
| 520 | [profile.test] |
| 521 | opt-level = 1 |
| 522 | |
| 523 | [profile.bench] |
| 524 | lto = true |
| 525 | codegen-units = 1 |
| 526 | |
| 527 | [lints] |
| 528 | workspace = true |
| 529 | |