[workspace] resolver = "2" members = [ "clap_bench", "clap_builder", "clap_derive", "clap_lex", "clap_complete", "clap_complete_fig", "clap_complete_nushell", "clap_mangen", ] [workspace.package] repository = "https://github.com/clap-rs/clap" license = "MIT OR Apache-2.0" edition = "2021" rust-version = "1.74" # MSRV include = [ "build.rs", "src/**/*", "Cargo.toml", "LICENSE*", "README.md", "benches/**/*", "examples/**/*" ] [workspace.lints.rust] rust_2018_idioms = { level = "warn", priority = -1 } unreachable_pub = "warn" unsafe_op_in_unsafe_fn = "warn" unused_lifetimes = "warn" unused_macro_rules = "warn" unused_qualifications = "warn" [workspace.lints.clippy] bool_assert_comparison = "allow" branches_sharing_code = "allow" checked_conversions = "warn" collapsible_else_if = "allow" create_dir = "warn" dbg_macro = "warn" debug_assert_with_mut_call = "warn" doc_markdown = "warn" empty_enum = "warn" enum_glob_use = "warn" expl_impl_clone_on_copy = "warn" explicit_deref_methods = "warn" explicit_into_iter_loop = "warn" fallible_impl_from = "warn" filter_map_next = "warn" flat_map_option = "warn" float_cmp_const = "warn" fn_params_excessive_bools = "warn" from_iter_instead_of_collect = "warn" if_same_then_else = "allow" implicit_clone = "warn" imprecise_flops = "warn" inconsistent_struct_constructor = "warn" inefficient_to_string = "warn" infinite_loop = "warn" invalid_upcast_comparisons = "warn" large_digit_groups = "warn" large_stack_arrays = "warn" large_types_passed_by_value = "warn" let_and_return = "allow" # sometimes good to name what you are returning linkedlist = "warn" lossy_float_literal = "warn" macro_use_imports = "warn" mem_forget = "warn" mutex_integer = "warn" needless_continue = "warn" needless_for_each = "warn" negative_feature_names = "warn" path_buf_push_overwrite = "warn" ptr_as_ptr = "warn" rc_mutex = "warn" redundant_feature_names = "warn" ref_option_ref = "warn" rest_pat_in_fully_bound_structs = "warn" same_functions_in_if_condition = "warn" self_named_module_files = "warn" semicolon_if_nothing_returned = "warn" # str_to_string = "warn" # string_add = "warn" string_add_assign = "warn" string_lit_as_bytes = "warn" # string_to_string = "warn" todo = "warn" trait_duplication_in_bounds = "warn" uninlined_format_args = "warn" verbose_file_reads = "warn" # wildcard_imports = "warn" zero_sized_map_values = "warn" # Fix later: multiple_bound_locations = "allow" assigning_clones = "allow" blocks_in_conditions = "allow" [package] name = "clap" version = "4.5.20" description = "A simple to use, efficient, and full-featured Command Line Argument Parser" categories = ["command-line-interface"] keywords = [ "argument", "cli", "arg", "parser", "parse" ] repository.workspace = true license.workspace = true edition.workspace = true rust-version.workspace = true include.workspace = true [package.metadata.docs.rs] features = ["unstable-doc"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] [package.metadata.playground] features = ["unstable-doc"] [package.metadata.release] shared-version = true tag-name = "v{{version}}" pre-release-replacements = [ {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1}, {file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1}, {file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1}, {file="CHANGELOG.md", search="", replace="\n## [Unreleased] - ReleaseDate\n", exactly=1}, {file="CHANGELOG.md", search="", replace="\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD", exactly=1}, {file="CITATION.cff", search="^date-released: ....-..-..", replace="date-released: {{date}}"}, {file="CITATION.cff", search="^version: .+\\..+\\..+", replace="version: {{version}}"}, {file="src/lib.rs", search="blob/v.+\\..+\\..+/CHANGELOG.md", replace="blob/v{{version}}/CHANGELOG.md", exactly=1}, ] [features] default = [ "std", "color", "help", "usage", "error-context", "suggestions", ] debug = ["clap_builder/debug", "clap_derive?/debug"] # Enables debug messages unstable-doc = ["clap_builder/unstable-doc", "derive"] # for docs.rs # Used in default std = ["clap_builder/std"] # support for no_std in a backwards-compatible way color = ["clap_builder/color"] help = ["clap_builder/help"] usage = ["clap_builder/usage"] error-context = ["clap_builder/error-context"] suggestions = ["clap_builder/suggestions"] # Optional deprecated = ["clap_builder/deprecated", "clap_derive?/deprecated"] # Guided experience to prepare for next breaking release (at different stages of development, this may become default) derive = ["dep:clap_derive"] cargo = ["clap_builder/cargo"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros wrap_help = ["clap_builder/wrap_help"] env = ["clap_builder/env"] # Use environment variables during arg parsing unicode = ["clap_builder/unicode"] # Support for unicode characters in arguments and help messages string = ["clap_builder/string"] # Allow runtime generated strings # In-work features unstable-v5 = ["clap_builder/unstable-v5", "clap_derive?/unstable-v5", "deprecated"] unstable-ext = ["clap_builder/unstable-ext"] unstable-styles = ["clap_builder/unstable-styles"] # deprecated unstable-derive-ui-tests = [] [lib] bench = false [dependencies] clap_builder = { path = "./clap_builder", version = "=4.5.20", default-features = false } clap_derive = { path = "./clap_derive", version = "=4.5.18", optional = true } [dev-dependencies] trybuild = "1.0.91" rustversion = "1.0.15" # Cutting out `filesystem` feature trycmd = { version = "0.15.3", default-features = false, features = ["color-auto", "diff", "examples"] } humantime = "2.1.0" snapbox = "0.6.16" shlex = "1.3.0" automod = "1.0.14" clap-cargo = { version = "0.14.1", default-features = false } [[example]] name = "demo" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "cargo-example" required-features = ["cargo", "color"] doc-scrape-examples = true [[example]] name = "cargo-example-derive" required-features = ["derive", "color"] doc-scrape-examples = true [[example]] name = "escaped-positional" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "escaped-positional-derive" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "find" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "git-derive" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "typed-derive" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "busybox" path = "examples/multicall-busybox.rs" doc-scrape-examples = true [[example]] name = "hostname" path = "examples/multicall-hostname.rs" doc-scrape-examples = true [[example]] name = "repl" path = "examples/repl.rs" required-features = ["help"] doc-scrape-examples = true [[example]] name = "repl-derive" path = "examples/repl-derive.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "01_quick" path = "examples/tutorial_builder/01_quick.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "02_apps" path = "examples/tutorial_builder/02_apps.rs" doc-scrape-examples = true [[example]] name = "02_crate" path = "examples/tutorial_builder/02_crate.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "02_app_settings" path = "examples/tutorial_builder/02_app_settings.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_01_flag_bool" path = "examples/tutorial_builder/03_01_flag_bool.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_01_flag_count" path = "examples/tutorial_builder/03_01_flag_count.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_02_option" path = "examples/tutorial_builder/03_02_option.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_02_option_mult" path = "examples/tutorial_builder/03_02_option_mult.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_03_positional" path = "examples/tutorial_builder/03_03_positional.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_03_positional_mult" path = "examples/tutorial_builder/03_03_positional_mult.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_04_subcommands" path = "examples/tutorial_builder/03_04_subcommands.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "03_05_default_values" path = "examples/tutorial_builder/03_05_default_values.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_01_possible" path = "examples/tutorial_builder/04_01_possible.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_01_enum" path = "examples/tutorial_builder/04_01_enum.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_02_parse" path = "examples/tutorial_builder/04_02_parse.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_02_validate" path = "examples/tutorial_builder/04_02_validate.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_03_relations" path = "examples/tutorial_builder/04_03_relations.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "04_04_custom" path = "examples/tutorial_builder/04_04_custom.rs" required-features = ["cargo"] doc-scrape-examples = true [[example]] name = "05_01_assert" path = "examples/tutorial_builder/05_01_assert.rs" required-features = ["cargo"] test = true doc-scrape-examples = true [[example]] name = "01_quick_derive" path = "examples/tutorial_derive/01_quick.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "02_apps_derive" path = "examples/tutorial_derive/02_apps.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "02_crate_derive" path = "examples/tutorial_derive/02_crate.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "02_app_settings_derive" path = "examples/tutorial_derive/02_app_settings.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_01_flag_bool_derive" path = "examples/tutorial_derive/03_01_flag_bool.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_01_flag_count_derive" path = "examples/tutorial_derive/03_01_flag_count.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_02_option_derive" path = "examples/tutorial_derive/03_02_option.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_02_option_mult_derive" path = "examples/tutorial_derive/03_02_option_mult.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_03_positional_derive" path = "examples/tutorial_derive/03_03_positional.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_03_positional_mult_derive" path = "examples/tutorial_derive/03_03_positional_mult.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_04_subcommands_derive" path = "examples/tutorial_derive/03_04_subcommands.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_04_subcommands_alt_derive" path = "examples/tutorial_derive/03_04_subcommands_alt.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "03_05_default_values_derive" path = "examples/tutorial_derive/03_05_default_values.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "04_01_enum_derive" path = "examples/tutorial_derive/04_01_enum.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "04_02_parse_derive" path = "examples/tutorial_derive/04_02_parse.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "04_02_validate_derive" path = "examples/tutorial_derive/04_02_validate.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "04_03_relations_derive" path = "examples/tutorial_derive/04_03_relations.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "04_04_custom_derive" path = "examples/tutorial_derive/04_04_custom.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "05_01_assert_derive" path = "examples/tutorial_derive/05_01_assert.rs" required-features = ["derive"] test = true doc-scrape-examples = true [[example]] name = "interop_augment_args" path = "examples/derive_ref/augment_args.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "interop_augment_subcommands" path = "examples/derive_ref/augment_subcommands.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "interop_hand_subcommand" path = "examples/derive_ref/hand_subcommand.rs" required-features = ["derive"] doc-scrape-examples = true [[example]] name = "interop_flatten_hand_args" path = "examples/derive_ref/flatten_hand_args.rs" required-features = ["derive"] doc-scrape-examples = true [profile.test] opt-level = 1 [profile.bench] lto = true codegen-units = 1 [lints] workspace = true