summaryrefslogtreecommitdiffstats
path: root/third_party/rust/clap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/clap
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/clap')
-rw-r--r--third_party/rust/clap/.cargo-checksum.json1
-rw-r--r--third_party/rust/clap/Cargo.lock846
-rw-r--r--third_party/rust/clap/Cargo.toml445
-rw-r--r--third_party/rust/clap/LICENSE-APACHE202
-rw-r--r--third_party/rust/clap/LICENSE-MIT19
-rw-r--r--third_party/rust/clap/README.md43
-rw-r--r--third_party/rust/clap/examples/README.md16
-rw-r--r--third_party/rust/clap/examples/cargo-example-derive.md38
-rw-r--r--third_party/rust/clap/examples/cargo-example-derive.rs20
-rw-r--r--third_party/rust/clap/examples/cargo-example.md38
-rw-r--r--third_party/rust/clap/examples/cargo-example.rs18
-rw-r--r--third_party/rust/clap/examples/demo.md17
-rw-r--r--third_party/rust/clap/examples/demo.rs22
-rw-r--r--third_party/rust/clap/examples/derive_ref/augment_args.rs27
-rw-r--r--third_party/rust/clap/examples/derive_ref/augment_subcommands.rs21
-rw-r--r--third_party/rust/clap/examples/derive_ref/flatten_hand_args.rs91
-rw-r--r--third_party/rust/clap/examples/derive_ref/hand_subcommand.rs79
-rw-r--r--third_party/rust/clap/examples/derive_ref/interop_tests.md248
-rw-r--r--third_party/rust/clap/examples/escaped-positional-derive.md60
-rw-r--r--third_party/rust/clap/examples/escaped-positional-derive.rs25
-rw-r--r--third_party/rust/clap/examples/escaped-positional.md60
-rw-r--r--third_party/rust/clap/examples/escaped-positional.rs32
-rw-r--r--third_party/rust/clap/examples/find.md45
-rw-r--r--third_party/rust/clap/examples/find.rs99
-rw-r--r--third_party/rust/clap/examples/git-derive.md159
-rw-r--r--third_party/rust/clap/examples/git-derive.rs164
-rw-r--r--third_party/rust/clap/examples/git.md157
-rw-r--r--third_party/rust/clap/examples/git.rs137
-rw-r--r--third_party/rust/clap/examples/multicall-busybox.md39
-rw-r--r--third_party/rust/clap/examples/multicall-busybox.rs47
-rw-r--r--third_party/rust/clap/examples/multicall-hostname.md10
-rw-r--r--third_party/rust/clap/examples/multicall-hostname.rs17
-rw-r--r--third_party/rust/clap/examples/pacman.md79
-rw-r--r--third_party/rust/clap/examples/pacman.rs111
-rw-r--r--third_party/rust/clap/examples/repl.rs92
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/01_quick.md35
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/01_quick.rs60
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_app_settings.md17
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_app_settings.rs18
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_apps.md16
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_apps.rs20
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_crate.md16
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/02_crate.rs18
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.md26
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.md21
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_02_option.md30
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_02_option.rs9
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.md30
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_03_positional.md20
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_03_positional.rs9
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.md23
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.rs15
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.md59
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.rs22
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_05_default_values.md20
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/03_05_default_values.rs18
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_01_enum.md47
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_01_enum.rs66
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_01_possible.md27
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_01_possible.rs26
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_02_parse.md29
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_02_parse.rs17
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_02_validate.md29
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_02_validate.rs36
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_03_relations.md53
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_03_relations.rs78
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_04_custom.md52
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/04_04_custom.rs84
-rw-r--r--third_party/rust/clap/examples/tutorial_builder/05_01_assert.rs25
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/01_quick.md35
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/01_quick.rs68
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_app_settings.md17
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_app_settings.rs18
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_apps.md16
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_apps.rs20
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_crate.md16
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/02_crate.rs17
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.md26
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.md21
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_02_option.md30
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_02_option.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.md30
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_03_positional.md20
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_03_positional.rs13
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.md23
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.rs13
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.md60
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.rs27
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_04_subcommands_alt.rs32
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_05_default_values.md20
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/03_05_default_values.rs14
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_01_enum.md47
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_01_enum.rs32
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_02_parse.md29
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_02_parse.rs15
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_02_validate.md29
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_02_validate.rs34
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_03_relations.md53
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_03_relations.rs75
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_04_custom.md52
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/04_04_custom.rs91
-rw-r--r--third_party/rust/clap/examples/tutorial_derive/05_01_assert.rs20
-rw-r--r--third_party/rust/clap/examples/typed-derive.md131
-rw-r--r--third_party/rust/clap/examples/typed-derive.rs102
-rw-r--r--third_party/rust/clap/src/_cookbook/cargo_example.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/cargo_example_derive.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/escaped_positional.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/escaped_positional_derive.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/find.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/git.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/git_derive.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/mod.rs61
-rw-r--r--third_party/rust/clap/src/_cookbook/multicall_busybox.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/multicall_hostname.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/pacman.rs7
-rw-r--r--third_party/rust/clap/src/_cookbook/repl.rs5
-rw-r--r--third_party/rust/clap/src/_cookbook/typed_derive.rs7
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_0.rs25
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_1.rs29
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_2.rs103
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_3.rs78
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_4.rs15
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/chapter_5.rs14
-rw-r--r--third_party/rust/clap/src/_derive/_tutorial/mod.rs36
-rw-r--r--third_party/rust/clap/src/_derive/mod.rs504
-rw-r--r--third_party/rust/clap/src/_faq.rs95
-rw-r--r--third_party/rust/clap/src/_features.rs28
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_0.rs24
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_1.rs31
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_2.rs87
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_3.rs84
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_4.rs15
-rw-r--r--third_party/rust/clap/src/_tutorial/chapter_5.rs12
-rw-r--r--third_party/rust/clap/src/_tutorial/mod.rs36
-rw-r--r--third_party/rust/clap/src/bin/stdio-fixture.rs26
-rw-r--r--third_party/rust/clap/src/lib.rs113
142 files changed, 7437 insertions, 0 deletions
diff --git a/third_party/rust/clap/.cargo-checksum.json b/third_party/rust/clap/.cargo-checksum.json
new file mode 100644
index 0000000000..34a5ddc5fe
--- /dev/null
+++ b/third_party/rust/clap/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.lock":"dc10322dcd3c98c29816e6adb0b3711c54943917f7fe16d80bfa0de3dca70c38","Cargo.toml":"d4b952ab9bce973b337b256bd946c3b4350cdf18566edfe613f25e57baf6fcb6","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"6efb0476a1cc085077ed49357026d8c173bf33017278ef440f222fb9cbcb66e6","README.md":"bcb96a3aedd4da85e24e201a4922e435928b0c0a2f97fd5843d0793a54e6a09f","examples/README.md":"c5f45032ee7acda0c5f98db456cbf4f9b0362d62dc81218fcf03bcdfbd19af05","examples/cargo-example-derive.md":"66d7455f08a038872f42d9d45f9b47ebbdbf9366fafa16b749ece8ba5bdcfcce","examples/cargo-example-derive.rs":"748ba54fb553e797996014e706320b62fad645acca50565a4c6fcd40e8aa1128","examples/cargo-example.md":"60a1d0f253142de5003a9474b28a5a8324a9860fc646af6309d84594d97356bd","examples/cargo-example.rs":"2c2eda50605a5e48c2ba78083e0f545e1df2411b9efaf994c95c9a0357ecbfb1","examples/demo.md":"6c00568794ff99007ab0f08bf7e06fe521cb1f2f0fab30c219f16c6f54bf638d","examples/demo.rs":"08cdd247b47a5202de9b7df7c1f3e7e30da975e56256d930d9db0f6c36741933","examples/derive_ref/augment_args.rs":"274bbe3c91d72609289274a22330067dd0ab42eb9bc3c44c94ed6da149ed56eb","examples/derive_ref/augment_subcommands.rs":"f202fd8a836552c53bb4b33a652b577f254726334f8a72f5fac0526937ab15ef","examples/derive_ref/flatten_hand_args.rs":"d3783fdea6297ffef23939df913ece655670b617f39addfab5147dc217e70fb1","examples/derive_ref/hand_subcommand.rs":"be49b475f86862295eb4d0a00086d5874896f9a66f28cca8fcdf6548943beba7","examples/derive_ref/interop_tests.md":"aaf307e313c3926b14f1265199ab18665bb3dea723729a7e6cbf3b237fa73941","examples/escaped-positional-derive.md":"fb4b4351ceb43ef0c25048e8603dab6fdf4391b84e9b3ad9593602fa89abc572","examples/escaped-positional-derive.rs":"4fe5f9dfbd15d3efcff7ff9b214d00c189ac0592e30b297b154df789e49dbfa3","examples/escaped-positional.md":"b44e23e5706eb815e7875825be815a370f2ba38e41d7998ea762d0ef1fb2ba56","examples/escaped-positional.rs":"e1e784bb90805ef3412f002d9660c979ebbd2d59eb609ceb7f8926c0ad8e7c31","examples/find.md":"acb72e150f9feeb5d7828163f0e36ff5004ae667f6ddbb06d2838a75037177ee","examples/find.rs":"0a9824ae817345e6989ad51b7d514101ee0e842da380e5bad4019ddd2cccedd0","examples/git-derive.md":"d214127af66033e0de4f9da869eb7e6ca073e7c7d7fdf8b6792cba75d39d68e9","examples/git-derive.rs":"4b0a28ef89e2c1578a9f134325495d303663d3cfcacb900ef6efcd38ef5fca44","examples/git.md":"449a75c1e0c7b2dd948b856c81a868f6b8f0c300667b17ec5dd638c6739d2175","examples/git.rs":"8b935b4f516802a9f64654719485fbe8cfc96263e3acd23a74235c3dbdf651ab","examples/multicall-busybox.md":"b8e8a89312e2088b6dd1fac5b5b92266fda9b82c40a650dae2d41b5fcc253594","examples/multicall-busybox.rs":"0be842810003f69de33c9e65258f74a5d1ec742fb0ebc8a49fdebfecc861c408","examples/multicall-hostname.md":"1dedcdcc9927c08cebee11fa01fda7a730f5ddf5227c4902e1eb5ff847a80346","examples/multicall-hostname.rs":"cc58a924dd2e57281f36e30481a1cbc8186952adbf149f9e1e13f9c673614fd9","examples/pacman.md":"a050be1727605a4202faf69db7f991bf974bba51ce0fbd41413de68e6a4af5aa","examples/pacman.rs":"e2183dd3c60f7c3949be6f3d21c85bf8a6b2a14913b675649a770be21c764eda","examples/repl.rs":"972ed0b06962f9daf20b7cee5dd6dc873fc31747e84bce646c0e057678c653f3","examples/tutorial_builder/01_quick.md":"d2a242a6ba832cdb0a2b6f55d428d62e7048f6b7d8d8f4a75f7923da85628ca8","examples/tutorial_builder/01_quick.rs":"7921943f7b697cf9413a87d0ebf32d6db4a93b2674cb66d9ca66530626088d1f","examples/tutorial_builder/02_app_settings.md":"4e7097deb0eb8e926978ef383b0da4bda33966d4e760ac0d258cd4127a054fba","examples/tutorial_builder/02_app_settings.rs":"c050d19fa8c0ecefde73746200fb513da0dd78d904011a1c0a75835fd9c172b3","examples/tutorial_builder/02_apps.md":"3cbc7010e0214d047d98104dadb76ee02ec3c5bba868758e35aebb2fdfd0fa22","examples/tutorial_builder/02_apps.rs":"e654126b44161d5b20ce2e576a6022f027060d003e07ae74c7bbdeddd6fcb880","examples/tutorial_builder/02_crate.md":"995dc62680b9d7c1983c673bf5775c07ae96175db186b5313c0d614308569ec0","examples/tutorial_builder/02_crate.rs":"b0bdc601133bf9e566231dd6be439d0ce82b6911ca53ae4b5c1b5da62eb2acd8","examples/tutorial_builder/03_01_flag_bool.md":"326d8267ce6fcc62e95fdb19f77bdc959067e41af48c7d6e465c0eafe2db741c","examples/tutorial_builder/03_01_flag_bool.rs":"d49b30b527faa6a383b334e572d546fab5c4b298a5549842073ab42a33a05c94","examples/tutorial_builder/03_01_flag_count.md":"c34ff091d239f5861a868bda051322774340be9a63dea32cbfabe8c0cc4dfd94","examples/tutorial_builder/03_01_flag_count.rs":"a003825bc045d4d89265344cfb00082da379150e72fc5d16b33ee93ec9ec0927","examples/tutorial_builder/03_02_option.md":"f436d35a7f2aece1a30f0258f44ae09166fb4faae3b6623beb6a824d2ed234fd","examples/tutorial_builder/03_02_option.rs":"13e58e3f922ef79bb4f3cec63f84dc906bb20ea8bbd33e5ca3cb8cfce847095a","examples/tutorial_builder/03_02_option_mult.md":"c83e0f52f97f38154be30ac34d7d60b9271fd8a0dcab629929ee785d3baa07a2","examples/tutorial_builder/03_02_option_mult.rs":"bd3e522d6ff4a1a9f5849924650acf8ea8afc1f4c3ba633e45926a479f54b7c7","examples/tutorial_builder/03_03_positional.md":"dc2e13cf897e2e2d2b397a1ab739bfd290ec04f437128030eb7f6f609b910be7","examples/tutorial_builder/03_03_positional.rs":"582ffa5b056363a74d2ba966d212fbd6b00f42fe42f0e71ae95009fe75746349","examples/tutorial_builder/03_03_positional_mult.md":"f1d03ca58d9ee75ec9a4cc980006a666e2c529ab6f7deaf6bd88b3fbaf09fc07","examples/tutorial_builder/03_03_positional_mult.rs":"271a9ee04038244fdf378c6a603af9d4cb6a401d82f9e28928c2e7ad971aff10","examples/tutorial_builder/03_04_subcommands.md":"64f5899e1bfb8c5f166642db89ba1de1a7f2dc88b3ea0025b3ce5543f12a605f","examples/tutorial_builder/03_04_subcommands.rs":"a309a332004edbed6dc14b64b1ba6cc0cd42871f3c5b8da7daab772764839c68","examples/tutorial_builder/03_05_default_values.md":"c30c72c85190aaddc06a7c0ed1cf87356eb81f03284b0e9c5f47d4f233d06a00","examples/tutorial_builder/03_05_default_values.rs":"96c8bd0004cf0dc0338851ccf4ae3309ec49e61cc90f41bcf912207eac95ea18","examples/tutorial_builder/04_01_enum.md":"c89cef996c17aa909031233b283349b23427c065b634d43ee82b974f4f28d1c6","examples/tutorial_builder/04_01_enum.rs":"04795a5d702f166e6283e1d4cc7dbaabdbe85e3e941b0cbf7ae1b205de72596b","examples/tutorial_builder/04_01_possible.md":"e16ec1ee5e7a67ab040afd4c87c3ebf84e5ab229491b73f3da337160a0dd14bb","examples/tutorial_builder/04_01_possible.rs":"3d781b26d257061b55a957744c2dbd99c1d2346c151230fb18fe5f576d19585c","examples/tutorial_builder/04_02_parse.md":"d02e8e79e96c2def7a2576a5acc06ba539061a221960ce89eeca1a51e52ef317","examples/tutorial_builder/04_02_parse.rs":"fb9f82791717775b7112bc829e950db29277c5b21367d73e322a87f326678fd4","examples/tutorial_builder/04_02_validate.md":"3f9f29b3629f0d20d8ff149ec721ee67a4baad39c12e2e379d472865c6cf682f","examples/tutorial_builder/04_02_validate.rs":"a5c03e60d4e475d23c38b253bcea29a4673f9494f60359a243f09b84c34e5a2a","examples/tutorial_builder/04_03_relations.md":"cfc6a4ee6d6912566773c9c86b92466725e8eb90c5c765d7cb603f2ffd0d911a","examples/tutorial_builder/04_03_relations.rs":"f367c93ddc7db37ec002a59e12d93ad58bdcf8b4b832c45adb4f6b197db31f0f","examples/tutorial_builder/04_04_custom.md":"11581660afa0679cda9355965cf55e0a282da9184f8d2eec97a415f48878002e","examples/tutorial_builder/04_04_custom.rs":"1da17cebc5a6a2887ba8f39070a47408c7ca6f16256a071f10d10a151b5e1f40","examples/tutorial_builder/05_01_assert.rs":"c42469ab8eeaaaab6dcec816459a934fb1380d208b14055d15e3e877b375bb20","examples/tutorial_derive/01_quick.md":"345bbe0689766fd83929826bffc32c9067c8e97c42fb7390db2620931bd27834","examples/tutorial_derive/01_quick.rs":"e00b44cd37ec6c618c94886438a18b3fc4dd507bdda483d177d7e50657d00c83","examples/tutorial_derive/02_app_settings.md":"7b3ef753653be837d6c7d92c805a8238dd61fce2fc46d58b860c3771dbfec113","examples/tutorial_derive/02_app_settings.rs":"23679bfe015a35a31e48c50a46d031a424fdb3ced7d35a787a35763addd932b9","examples/tutorial_derive/02_apps.md":"166b48034c788304ce9d3f48f91dd7b1b7e18a6d66f689114ba618d79b60cc24","examples/tutorial_derive/02_apps.rs":"9dc8a352dacd46e46ed325f1c64054cda6793b295317baf212691acb683d8eb3","examples/tutorial_derive/02_crate.md":"c15606793151791bddf5763f660a913f799303e8de4c1d28334449d0d184681d","examples/tutorial_derive/02_crate.rs":"8096171c44d7582d23f3f9732c017fb09bfa697bf0fe8c9736f27f27e060e4e1","examples/tutorial_derive/03_01_flag_bool.md":"7ffa235eb4bc61aaa15d63d4301250e2a6635520c02a55aa6294afe6798f39a0","examples/tutorial_derive/03_01_flag_bool.rs":"2a71de11b6362609bd3e59e81ec8c50de0f45d76e5e14507ab243b35e576574d","examples/tutorial_derive/03_01_flag_count.md":"02e6dc26d00cc82109350ca7910e4962007b91fe82fde1c8b86ae49dc4428a76","examples/tutorial_derive/03_01_flag_count.rs":"09715f20ef0c138e9d330b412c0fc3776601dfaaf0399abbc4e853cf0dc68142","examples/tutorial_derive/03_02_option.md":"3ff91da5ee7bb987bf3e4e66ab1148973664ca9b50b9dd97d40b76f623a0f607","examples/tutorial_derive/03_02_option.rs":"4b6a052257bb74818a22d55f9251060ae82b8a79d109b8ef1c1db786e46035e6","examples/tutorial_derive/03_02_option_mult.md":"7a98b02fc3ddf9506134d6bb04d7967b234dac694c2a4e65398e69d53b0e9240","examples/tutorial_derive/03_02_option_mult.rs":"e4683aa309a1d4e301a93fb57338e33f7f64c117390e3013bdbfe5387f7f12ea","examples/tutorial_derive/03_03_positional.md":"52a5c10dccc3774a29e1fe6f7ff87d44eaee67d723404ddcbec24f32b7b0f048","examples/tutorial_derive/03_03_positional.rs":"ed20f87f79e707f0d37428f5b0bb1e3eef92c91bb8b5a240bfb96700fc9333e3","examples/tutorial_derive/03_03_positional_mult.md":"00e3fc665835a4df1190a5ecb7c854b1259ab2324966d69ac40770cde8e2dd21","examples/tutorial_derive/03_03_positional_mult.rs":"a24ab54fbd7569f41b89693ee82c583efd2278af811f7d16326063877700853c","examples/tutorial_derive/03_04_subcommands.md":"361ef1b34f84919831248a8ea141474a89efb1bc46b977ade51f61cc3dfc85a1","examples/tutorial_derive/03_04_subcommands.rs":"dc1676288d344d3e1c84e1cf966efd3710fd8b960d241b2983d9c0c5768d51bc","examples/tutorial_derive/03_04_subcommands_alt.rs":"6f72b64d40a6bfdd0efea7091369ed4bc211c6bece930a661c8b57db5d869611","examples/tutorial_derive/03_05_default_values.md":"b09e17bf0322311801881f53d9b86e5179163d4b05263988a79fd7d2b5c1eb79","examples/tutorial_derive/03_05_default_values.rs":"525fc5b62634c1a264896bc14349d62268870a30148f559635272b7578b15196","examples/tutorial_derive/04_01_enum.md":"fa1deb854c06f6ca921b53e9fd98eaf8ff0a641095a592552537ed74197ef801","examples/tutorial_derive/04_01_enum.rs":"20ae81993a8d8af4cebb2a6c424d2df0bda8cb9d252e7151927462857539d89c","examples/tutorial_derive/04_02_parse.md":"a87492c5d6fb9817345f67389142282394c525fbeade3a2750b84d949cba1c7e","examples/tutorial_derive/04_02_parse.rs":"25fbe9a2621cda28a108aadb22d48d09eec8b5f5e58abc22e4628ec13ddfb2c2","examples/tutorial_derive/04_02_validate.md":"8f83fdf4ccb89550c0df20eef49358cb222ca1a7404c18e3eafed6413c0e1313","examples/tutorial_derive/04_02_validate.rs":"14dceb712b19ee28ea2c5acb53f19eaa507a9c7f85aa1bdf2b88f711ff983d5a","examples/tutorial_derive/04_03_relations.md":"15172a1e5b056ee30b6ab1fbe848c71d8499b06aa74ce30219275989034c76ac","examples/tutorial_derive/04_03_relations.rs":"c6391c46ddc5ca73423f1d290b590eff8a5280ffa6a98b198cda8d256b9d2c3f","examples/tutorial_derive/04_04_custom.md":"f96f4ced9cce7e04e5150c2906cac315bce04a5319cab080917dd976cb815bdc","examples/tutorial_derive/04_04_custom.rs":"fa5082c4e895bb73eb8ed0bcf2c1e0ca84e76240392aa1d618bec5aca36a8166","examples/tutorial_derive/05_01_assert.rs":"04927db39bdecc354f88ecbe6366b565e0f1a01c8de7c78e8db717b1e847596f","examples/typed-derive.md":"6eacd8a18cf5c77f974247e00d2f60f58b6520915c9956cb7f432be2da1757d9","examples/typed-derive.rs":"ce8b7ca425bc0b3cfe6017d119cd7a54617081392cdea4830ecff1b4e5c5c8cb","src/_cookbook/cargo_example.rs":"fe7594a5233e9106a159aa1f5d5f0cde0d844356f630d55c78b8ef322327d4e5","src/_cookbook/cargo_example_derive.rs":"badf3e931ef5d5b7f5addc4912aca057ba83ee6302c43d7eeecd1661673fd407","src/_cookbook/escaped_positional.rs":"2789d8fea126355805b29e76b52c6cea4982565014087a46e0d48e4ddfbed7ab","src/_cookbook/escaped_positional_derive.rs":"802d0b672f4ed48152235d4a26a64c97fa921b361177bdd3a1a33cbac96f665d","src/_cookbook/find.rs":"6152ad5df466adc6de56bddb0f01930b4e4db1997fa972b055217cc7d6748a0a","src/_cookbook/git.rs":"372977252a22fc776e3acaa4629e964114ccd6a49b8ef334d2b6646f12e8b5ee","src/_cookbook/git_derive.rs":"4ab7c0197efda06607ca60c2a85ea743aed3494f5fe9e408d935ea0500a345fc","src/_cookbook/mod.rs":"a8f69fa55207d276471298acc7e22f2f08558dcaa826efbfe4ca8cf66ada2034","src/_cookbook/multicall_busybox.rs":"56176b4fa15e7a39c433706971d4e68aaf26ddc2a5790078b6dbe722ee13efee","src/_cookbook/multicall_hostname.rs":"907f8decf81ea4d4cbf81639ea4cd2f925eda64d4831454a7656369b65522780","src/_cookbook/pacman.rs":"863125b2d3d7931a9e4541c8ab1242b8bfcb421d8b5c604ea681efd805f68da7","src/_cookbook/repl.rs":"1393209b2cc5c203296d57c5a065b764b4318be7855e48baf16de851e250cf90","src/_cookbook/typed_derive.rs":"3d28e78cd0b068b4fcb32a7fea6244de176f2fe75dfcb59e99c33b66a7ae4864","src/_derive/_tutorial/chapter_0.rs":"830267bbb1b54cba4dbdec887877e9a2444dfa525896810c1a982bbb1c3c3056","src/_derive/_tutorial/chapter_1.rs":"4644a756f76bdf37b40296f3e80be0a2c33867c710e9d87e799d16ba1772c10e","src/_derive/_tutorial/chapter_2.rs":"e11c39bdb68e5d5c7791b3c1a30fddd7a24c6ddb18c94f4dc8b67ef2e96113a4","src/_derive/_tutorial/chapter_3.rs":"e2e1e95a8824a73e719651e485e95b72be7ee8730fd6f8744beef77875ceb594","src/_derive/_tutorial/chapter_4.rs":"427ccc31481d0884de70d4bed8ce98d8c602cdb1028cd97196e69ba3fbb0de90","src/_derive/_tutorial/chapter_5.rs":"7d723bfe574f9c38418b17883b7fbaa10f4babcf78d6443f7075a4ad923b5bd5","src/_derive/_tutorial/mod.rs":"9253795ea95033c1271b340fcb05ff0da52cc76b820e8a0c9083e63ca3ef7194","src/_derive/mod.rs":"f75a06f1499f1aff0613902649ad1b738a74cc6ff8765a112e70f8f60696be2c","src/_faq.rs":"52f274439b3608a6fea5b2d0096ee36869603afc505767fb44e7f7823162f5e0","src/_features.rs":"1ad6c43256efcd1fa9b42f837e79f252412d6691332b5317081e31a29a717a76","src/_tutorial/chapter_0.rs":"14ec920659bcda23dd4f392a987a6961bb7c04d2c01655dc2bc9c818f0e32f7f","src/_tutorial/chapter_1.rs":"719d6e4316d3496046077bf1cea91ee2c4444f100f6837d60031e1c624876202","src/_tutorial/chapter_2.rs":"0eb36348ab64c6560d4d0eb562f9f0fb02b94ccd58837efd3e64bb3092aee717","src/_tutorial/chapter_3.rs":"6f336c84909e809283309706239ba56a03ee23d13aa95e9b4eeb4d314ed50f87","src/_tutorial/chapter_4.rs":"beae5be9b371fb9139421ce668a27304c64beb78e5ab6e4b3c624d849f364850","src/_tutorial/chapter_5.rs":"e85e08d4d9daf0f7f23a6b3b1f4fc612d3b910d370836883f262ec11d8634d23","src/_tutorial/mod.rs":"cb73f13e7c8b006185a8323580f0495e1580047c426dd6d515afeb40d69bfaef","src/bin/stdio-fixture.rs":"87d1028fb4a3c8fb887586ea962a7b791f09216d1c944f4906df7a3e3b5e3e02","src/lib.rs":"083ce57674d79a5494bddac3554a4f8e608c8ce4624d10b398a78b1502250663"},"package":"824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3"} \ No newline at end of file
diff --git a/third_party/rust/clap/Cargo.lock b/third_party/rust/clap/Cargo.lock
new file mode 100644
index 0000000000..f09c7e0e12
--- /dev/null
+++ b/third_party/rust/clap/Cargo.lock
@@ -0,0 +1,846 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "anstream"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd"
+dependencies = [
+ "anstyle",
+ "windows-sys",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "backtrace"
+version = "0.3.67"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "basic-toml"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e819b667739967cd44d308b8c7b71305d8bb0729ac44a248aa08f33d01950b4"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
+
+[[package]]
+name = "cc"
+version = "1.0.83"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clap"
+version = "4.4.5"
+dependencies = [
+ "clap_builder",
+ "clap_derive",
+ "humantime",
+ "rustversion",
+ "shlex",
+ "snapbox",
+ "static_assertions",
+ "trybuild",
+ "trycmd",
+ "unic-emoji-char",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "backtrace",
+ "clap_lex",
+ "strsim",
+ "terminal_size",
+ "unicase",
+ "unicode-width",
+]
+
+[[package]]
+name = "clap_derive"
+version = "4.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
+
+[[package]]
+name = "crossbeam-channel"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
+dependencies = [
+ "cfg-if",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
+dependencies = [
+ "cfg-if",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348"
+dependencies = [
+ "autocfg",
+ "cfg-if",
+ "crossbeam-utils",
+ "memoffset",
+ "scopeguard",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "either"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
+
+[[package]]
+name = "errno"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
+dependencies = [
+ "errno-dragonfly",
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
+name = "escargot"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5584ba17d7ab26a8a7284f13e5bd196294dd2f2d79773cff29b9e9edef601a6"
+dependencies = [
+ "log",
+ "once_cell",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "gimli"
+version = "0.27.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
+
+[[package]]
+name = "glob"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+
+[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "humantime"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+
+[[package]]
+name = "humantime-serde"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c"
+dependencies = [
+ "humantime",
+ "serde",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
+
+[[package]]
+name = "libc"
+version = "0.2.147"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
+
+[[package]]
+name = "log"
+version = "0.4.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "memchr"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+
+[[package]]
+name = "memoffset"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "miniz_oxide"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "normalize-line-endings"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
+
+[[package]]
+name = "num_cpus"
+version = "1.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "object"
+version = "0.30.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+
+[[package]]
+name = "os_pipe"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.66"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rayon"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
+dependencies = [
+ "either",
+ "rayon-core",
+]
+
+[[package]]
+name = "rayon-core"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-deque",
+ "crossbeam-utils",
+ "num_cpus",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
+
+[[package]]
+name = "rustix"
+version = "0.38.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
+
+[[package]]
+name = "ryu"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
+
+[[package]]
+name = "scopeguard"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+
+[[package]]
+name = "serde"
+version = "1.0.180"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.180"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "shlex"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
+
+[[package]]
+name = "similar"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803"
+
+[[package]]
+name = "snapbox"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad90eb3a2e3a8031d636d45bd4832751aefd58a291b553f7305a2bacae21aff3"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "escargot",
+ "libc",
+ "normalize-line-endings",
+ "os_pipe",
+ "similar",
+ "snapbox-macros",
+ "wait-timeout",
+ "windows-sys",
+]
+
+[[package]]
+name = "snapbox-macros"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95f4ffd811b87da98d0e48285134b7847954bd76e843bb794a893b47ca3ee325"
+dependencies = [
+ "anstream",
+]
+
+[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
+[[package]]
+name = "strsim"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+
+[[package]]
+name = "syn"
+version = "2.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "termcolor"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "terminal_size"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
+dependencies = [
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.19.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "trybuild"
+version = "1.0.83"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6df60d81823ed9c520ee897489573da4b1d79ffbe006b8134f46de1a1aa03555"
+dependencies = [
+ "basic-toml",
+ "glob",
+ "once_cell",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "termcolor",
+]
+
+[[package]]
+name = "trycmd"
+version = "0.14.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc6a42f89ccf3c6ee115608a68e256c172734d525a4ac36d4a17a6d4a8108149"
+dependencies = [
+ "glob",
+ "humantime",
+ "humantime-serde",
+ "rayon",
+ "serde",
+ "shlex",
+ "snapbox",
+ "toml_edit",
+]
+
+[[package]]
+name = "unic-char-property"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
+dependencies = [
+ "unic-char-range",
+]
+
+[[package]]
+name = "unic-char-range"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
+
+[[package]]
+name = "unic-common"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
+
+[[package]]
+name = "unic-emoji-char"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b07221e68897210270a38bde4babb655869637af0f69407f96053a34f76494d"
+dependencies = [
+ "unic-char-property",
+ "unic-char-range",
+ "unic-ucd-version",
+]
+
+[[package]]
+name = "unic-ucd-version"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
+dependencies = [
+ "unic-common",
+]
+
+[[package]]
+name = "unicase"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
+dependencies = [
+ "version_check",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
+
+[[package]]
+name = "unicode-width"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+
+[[package]]
+name = "version_check"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+
+[[package]]
+name = "wait-timeout"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "winnow"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699"
+dependencies = [
+ "memchr",
+]
diff --git a/third_party/rust/clap/Cargo.toml b/third_party/rust/clap/Cargo.toml
new file mode 100644
index 0000000000..19de2fe6f3
--- /dev/null
+++ b/third_party/rust/clap/Cargo.toml
@@ -0,0 +1,445 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2021"
+rust-version = "1.70.0"
+name = "clap"
+version = "4.4.5"
+include = [
+ "build.rs",
+ "src/**/*",
+ "Cargo.toml",
+ "LICENSE*",
+ "README.md",
+ "benches/**/*",
+ "examples/**/*",
+]
+description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
+readme = "README.md"
+keywords = [
+ "argument",
+ "cli",
+ "arg",
+ "parser",
+ "parse",
+]
+categories = ["command-line-interface"]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/clap-rs/clap"
+
+[package.metadata.docs.rs]
+cargo-args = [
+ "-Zunstable-options",
+ "-Zrustdoc-scrape-examples",
+]
+features = ["unstable-doc"]
+rustdoc-args = [
+ "--cfg",
+ "docsrs",
+ "--generate-link-to-definition",
+]
+
+[package.metadata.playground]
+features = ["unstable-doc"]
+
+[package.metadata.release]
+shared-version = true
+tag-name = "v{{version}}"
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+min = 1
+replace = "{{version}}"
+search = "Unreleased"
+
+[[package.metadata.release.pre-release-replacements]]
+exactly = 1
+file = "CHANGELOG.md"
+replace = "...{{tag_name}}"
+search = '\.\.\.HEAD'
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+min = 1
+replace = "{{date}}"
+search = "ReleaseDate"
+
+[[package.metadata.release.pre-release-replacements]]
+exactly = 1
+file = "CHANGELOG.md"
+replace = """
+<!-- next-header -->
+## [Unreleased] - ReleaseDate
+"""
+search = "<!-- next-header -->"
+
+[[package.metadata.release.pre-release-replacements]]
+exactly = 1
+file = "CHANGELOG.md"
+replace = """
+<!-- next-url -->
+[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD"""
+search = "<!-- next-url -->"
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CITATION.cff"
+replace = "date-released: {{date}}"
+search = "^date-released: ....-..-.."
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CITATION.cff"
+replace = "version: {{version}}"
+search = '^version: .+\..+\..+'
+
+[profile.bench]
+lto = true
+codegen-units = 1
+
+[profile.test]
+opt-level = 1
+
+[lib]
+bench = false
+
+[[example]]
+name = "demo"
+required-features = ["derive"]
+
+[[example]]
+name = "cargo-example"
+required-features = ["cargo"]
+
+[[example]]
+name = "cargo-example-derive"
+required-features = ["derive"]
+
+[[example]]
+name = "escaped-positional"
+required-features = ["cargo"]
+
+[[example]]
+name = "escaped-positional-derive"
+required-features = ["derive"]
+
+[[example]]
+name = "find"
+required-features = ["cargo"]
+
+[[example]]
+name = "git-derive"
+required-features = ["derive"]
+
+[[example]]
+name = "typed-derive"
+required-features = ["derive"]
+
+[[example]]
+name = "busybox"
+path = "examples/multicall-busybox.rs"
+
+[[example]]
+name = "hostname"
+path = "examples/multicall-hostname.rs"
+
+[[example]]
+name = "repl"
+path = "examples/repl.rs"
+required-features = ["help"]
+
+[[example]]
+name = "01_quick"
+path = "examples/tutorial_builder/01_quick.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "02_apps"
+path = "examples/tutorial_builder/02_apps.rs"
+
+[[example]]
+name = "02_crate"
+path = "examples/tutorial_builder/02_crate.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "02_app_settings"
+path = "examples/tutorial_builder/02_app_settings.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_01_flag_bool"
+path = "examples/tutorial_builder/03_01_flag_bool.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_01_flag_count"
+path = "examples/tutorial_builder/03_01_flag_count.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_02_option"
+path = "examples/tutorial_builder/03_02_option.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_02_option_mult"
+path = "examples/tutorial_builder/03_02_option_mult.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_03_positional"
+path = "examples/tutorial_builder/03_03_positional.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_03_positional_mult"
+path = "examples/tutorial_builder/03_03_positional_mult.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_04_subcommands"
+path = "examples/tutorial_builder/03_04_subcommands.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "03_05_default_values"
+path = "examples/tutorial_builder/03_05_default_values.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_01_possible"
+path = "examples/tutorial_builder/04_01_possible.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_01_enum"
+path = "examples/tutorial_builder/04_01_enum.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_02_parse"
+path = "examples/tutorial_builder/04_02_parse.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_02_validate"
+path = "examples/tutorial_builder/04_02_validate.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_03_relations"
+path = "examples/tutorial_builder/04_03_relations.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "04_04_custom"
+path = "examples/tutorial_builder/04_04_custom.rs"
+required-features = ["cargo"]
+
+[[example]]
+name = "05_01_assert"
+path = "examples/tutorial_builder/05_01_assert.rs"
+test = true
+required-features = ["cargo"]
+
+[[example]]
+name = "01_quick_derive"
+path = "examples/tutorial_derive/01_quick.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "02_apps_derive"
+path = "examples/tutorial_derive/02_apps.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "02_crate_derive"
+path = "examples/tutorial_derive/02_crate.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "02_app_settings_derive"
+path = "examples/tutorial_derive/02_app_settings.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_01_flag_bool_derive"
+path = "examples/tutorial_derive/03_01_flag_bool.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_01_flag_count_derive"
+path = "examples/tutorial_derive/03_01_flag_count.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_02_option_derive"
+path = "examples/tutorial_derive/03_02_option.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_02_option_mult_derive"
+path = "examples/tutorial_derive/03_02_option_mult.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_03_positional_derive"
+path = "examples/tutorial_derive/03_03_positional.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_03_positional_mult_derive"
+path = "examples/tutorial_derive/03_03_positional_mult.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_04_subcommands_derive"
+path = "examples/tutorial_derive/03_04_subcommands.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_04_subcommands_alt_derive"
+path = "examples/tutorial_derive/03_04_subcommands_alt.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "03_05_default_values_derive"
+path = "examples/tutorial_derive/03_05_default_values.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "04_01_enum_derive"
+path = "examples/tutorial_derive/04_01_enum.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "04_02_parse_derive"
+path = "examples/tutorial_derive/04_02_parse.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "04_02_validate_derive"
+path = "examples/tutorial_derive/04_02_validate.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "04_03_relations_derive"
+path = "examples/tutorial_derive/04_03_relations.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "04_04_custom_derive"
+path = "examples/tutorial_derive/04_04_custom.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "05_01_assert_derive"
+path = "examples/tutorial_derive/05_01_assert.rs"
+test = true
+required-features = ["derive"]
+
+[[example]]
+name = "interop_augment_args"
+path = "examples/derive_ref/augment_args.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "interop_augment_subcommands"
+path = "examples/derive_ref/augment_subcommands.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "interop_hand_subcommand"
+path = "examples/derive_ref/hand_subcommand.rs"
+required-features = ["derive"]
+
+[[example]]
+name = "interop_flatten_hand_args"
+path = "examples/derive_ref/flatten_hand_args.rs"
+required-features = ["derive"]
+
+[dependencies.clap_builder]
+version = "=4.4.5"
+default-features = false
+
+[dependencies.clap_derive]
+version = "=4.4.2"
+optional = true
+
+[dev-dependencies.humantime]
+version = "2.1.0"
+
+[dev-dependencies.rustversion]
+version = "1.0.14"
+
+[dev-dependencies.shlex]
+version = "1.1.0"
+
+[dev-dependencies.snapbox]
+version = "0.4.12"
+
+[dev-dependencies.static_assertions]
+version = "1.1.0"
+
+[dev-dependencies.trybuild]
+version = "1.0.83"
+
+[dev-dependencies.trycmd]
+version = "0.14.17"
+features = [
+ "color-auto",
+ "diff",
+ "examples",
+]
+default-features = false
+
+[dev-dependencies.unic-emoji-char]
+version = "0.9.0"
+
+[features]
+cargo = ["clap_builder/cargo"]
+color = ["clap_builder/color"]
+debug = [
+ "clap_builder/debug",
+ "clap_derive?/debug",
+]
+default = [
+ "std",
+ "color",
+ "help",
+ "usage",
+ "error-context",
+ "suggestions",
+]
+deprecated = [
+ "clap_builder/deprecated",
+ "clap_derive?/deprecated",
+]
+derive = ["dep:clap_derive"]
+env = ["clap_builder/env"]
+error-context = ["clap_builder/error-context"]
+help = ["clap_builder/help"]
+std = ["clap_builder/std"]
+string = ["clap_builder/string"]
+suggestions = ["clap_builder/suggestions"]
+unicode = ["clap_builder/unicode"]
+unstable-doc = [
+ "clap_builder/unstable-doc",
+ "derive",
+]
+unstable-styles = ["clap_builder/unstable-styles"]
+unstable-v5 = [
+ "clap_builder/unstable-v5",
+ "clap_derive?/unstable-v5",
+ "deprecated",
+]
+usage = ["clap_builder/usage"]
+wrap_help = ["clap_builder/wrap_help"]
diff --git a/third_party/rust/clap/LICENSE-APACHE b/third_party/rust/clap/LICENSE-APACHE
new file mode 100644
index 0000000000..8f71f43fee
--- /dev/null
+++ b/third_party/rust/clap/LICENSE-APACHE
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/third_party/rust/clap/LICENSE-MIT b/third_party/rust/clap/LICENSE-MIT
new file mode 100644
index 0000000000..a2d01088b6
--- /dev/null
+++ b/third_party/rust/clap/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) Individual contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/third_party/rust/clap/README.md b/third_party/rust/clap/README.md
new file mode 100644
index 0000000000..b1298f80e0
--- /dev/null
+++ b/third_party/rust/clap/README.md
@@ -0,0 +1,43 @@
+# clap
+
+> **Command Line Argument Parser for Rust**
+
+[![Crates.io](https://img.shields.io/crates/v/clap?style=flat-square)](https://crates.io/crates/clap)
+[![Crates.io](https://img.shields.io/crates/d/clap?style=flat-square)](https://crates.io/crates/clap)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](LICENSE-APACHE)
+[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE-MIT)
+[![Build Status](https://img.shields.io/github/actions/workflow/status/clap-rs/clap/ci.yml?branch=master&style=flat-square)](https://github.com/clap-rs/clap/actions/workflows/ci.yml?query=branch%3Amaster)
+[![Coverage Status](https://img.shields.io/coveralls/github/clap-rs/clap/master?style=flat-square)](https://coveralls.io/github/clap-rs/clap?branch=master)
+[![Contributors](https://img.shields.io/github/contributors/clap-rs/clap?style=flat-square)](https://github.com/clap-rs/clap/graphs/contributors)
+
+Dual-licensed under [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT).
+
+## About
+
+Create your command-line parser, with all of the bells and whistles, declaratively or procedurally.
+
+For more details, see:
+- [docs.rs](https://docs.rs/clap/latest/clap/)
+- [examples](examples/)
+
+## Sponsors
+
+<!-- omit in TOC -->
+### Gold
+
+[![](https://opencollective.com/clap/tiers/gold.svg?avatarHeight=36&width=600)](https://opencollective.com/clap)
+
+<!-- omit in TOC -->
+### Silver
+
+[![](https://opencollective.com/clap/tiers/silver.svg?avatarHeight=36&width=600)](https://opencollective.com/clap)
+
+<!-- omit in TOC -->
+### Bronze
+
+[![](https://opencollective.com/clap/tiers/bronze.svg?avatarHeight=36&width=600)](https://opencollective.com/clap)
+
+<!-- omit in TOC -->
+### Backer
+
+[![](https://opencollective.com/clap/tiers/backer.svg?avatarHeight=36&width=600)](https://opencollective.com/clap)
diff --git a/third_party/rust/clap/examples/README.md b/third_party/rust/clap/examples/README.md
new file mode 100644
index 0000000000..f98c370c82
--- /dev/null
+++ b/third_party/rust/clap/examples/README.md
@@ -0,0 +1,16 @@
+# Examples
+
+We try to focus our documentation on the [four types of
+documentation](https://documentation.divio.com/). Examples fit into this by
+providing:
+- [Cookbook / How-To Guides](https://docs.rs/clap/latest/clap/_cookbook/index.html)
+- Tutorials ([derive](https://docs.rs/clap/latest/clap/_derive/_tutorial/index.html), [builder](https://docs.rs/clap/latest/clap/_tutorial/index.html))
+
+This directory contains the source for the above.
+
+## Contributing
+
+New examples should fit within the above structure and support their narrative
+- Add the example to [Cargo.toml](../Cargo.toml) for any `required-features`
+- Document how the example works with a `.md` file which will be verified using [trycmd](https://docs.rs/trycmd)
+- Pull the `.rs` and `.md` file into the appropriate module doc comment to be accessible on docs.rs
diff --git a/third_party/rust/clap/examples/cargo-example-derive.md b/third_party/rust/clap/examples/cargo-example-derive.md
new file mode 100644
index 0000000000..a3dcef386f
--- /dev/null
+++ b/third_party/rust/clap/examples/cargo-example-derive.md
@@ -0,0 +1,38 @@
+For more on creating a custom subcommand, see [the cargo
+book](https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands).
+The crate [`clap-cargo`](https://github.com/crate-ci/clap-cargo) can help in
+mimicking cargo's interface.
+
+The help looks like:
+```console
+$ cargo-example-derive --help
+Usage: cargo <COMMAND>
+
+Commands:
+ example-derive A simple to use, efficient, and full-featured Command Line Argument Parser
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ cargo-example-derive example-derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: cargo example-derive [OPTIONS]
+
+Options:
+ --manifest-path <MANIFEST_PATH>
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Then to directly invoke the command, run:
+```console
+$ cargo-example-derive example-derive
+None
+
+$ cargo-example-derive example-derive --manifest-path Cargo.toml
+Some("Cargo.toml")
+
+```
diff --git a/third_party/rust/clap/examples/cargo-example-derive.rs b/third_party/rust/clap/examples/cargo-example-derive.rs
new file mode 100644
index 0000000000..dfdd799fc1
--- /dev/null
+++ b/third_party/rust/clap/examples/cargo-example-derive.rs
@@ -0,0 +1,20 @@
+use clap::Parser;
+
+#[derive(Parser)] // requires `derive` feature
+#[command(name = "cargo")]
+#[command(bin_name = "cargo")]
+enum CargoCli {
+ ExampleDerive(ExampleDeriveArgs),
+}
+
+#[derive(clap::Args)]
+#[command(author, version, about, long_about = None)]
+struct ExampleDeriveArgs {
+ #[arg(long)]
+ manifest_path: Option<std::path::PathBuf>,
+}
+
+fn main() {
+ let CargoCli::ExampleDerive(args) = CargoCli::parse();
+ println!("{:?}", args.manifest_path);
+}
diff --git a/third_party/rust/clap/examples/cargo-example.md b/third_party/rust/clap/examples/cargo-example.md
new file mode 100644
index 0000000000..edf8ee18a3
--- /dev/null
+++ b/third_party/rust/clap/examples/cargo-example.md
@@ -0,0 +1,38 @@
+For more on creating a custom subcommand, see [the cargo
+book](https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands).
+The crate [`clap-cargo`](https://github.com/crate-ci/clap-cargo) can help in
+mimicking cargo's interface.
+
+The help looks like:
+```console
+$ cargo-example --help
+Usage: cargo <COMMAND>
+
+Commands:
+ example A simple to use, efficient, and full-featured Command Line Argument Parser
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ cargo-example example --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: cargo example [OPTIONS]
+
+Options:
+ --manifest-path <PATH>
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Then to directly invoke the command, run:
+```console
+$ cargo-example example
+None
+
+$ cargo-example example --manifest-path Cargo.toml
+Some("Cargo.toml")
+
+```
diff --git a/third_party/rust/clap/examples/cargo-example.rs b/third_party/rust/clap/examples/cargo-example.rs
new file mode 100644
index 0000000000..1173365144
--- /dev/null
+++ b/third_party/rust/clap/examples/cargo-example.rs
@@ -0,0 +1,18 @@
+fn main() {
+ let cmd = clap::Command::new("cargo")
+ .bin_name("cargo")
+ .subcommand_required(true)
+ .subcommand(
+ clap::command!("example").arg(
+ clap::arg!(--"manifest-path" <PATH>)
+ .value_parser(clap::value_parser!(std::path::PathBuf)),
+ ),
+ );
+ let matches = cmd.get_matches();
+ let matches = match matches.subcommand() {
+ Some(("example", matches)) => matches,
+ _ => unreachable!("clap should ensure we don't get here"),
+ };
+ let manifest_path = matches.get_one::<std::path::PathBuf>("manifest-path");
+ println!("{manifest_path:?}");
+}
diff --git a/third_party/rust/clap/examples/demo.md b/third_party/rust/clap/examples/demo.md
new file mode 100644
index 0000000000..772d98dca0
--- /dev/null
+++ b/third_party/rust/clap/examples/demo.md
@@ -0,0 +1,17 @@
+```console
+$ demo --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: demo[EXE] [OPTIONS] --name <NAME>
+
+Options:
+ -n, --name <NAME> Name of the person to greet
+ -c, --count <COUNT> Number of times to greet [default: 1]
+ -h, --help Print help
+ -V, --version Print version
+
+$ demo --name Me
+Hello Me!
+
+```
+*(version number and `.exe` extension on windows replaced by placeholders)*
diff --git a/third_party/rust/clap/examples/demo.rs b/third_party/rust/clap/examples/demo.rs
new file mode 100644
index 0000000000..8e4304a2e6
--- /dev/null
+++ b/third_party/rust/clap/examples/demo.rs
@@ -0,0 +1,22 @@
+use clap::Parser;
+
+/// Simple program to greet a person
+#[derive(Parser, Debug)]
+#[command(author, version, about, long_about = None)]
+struct Args {
+ /// Name of the person to greet
+ #[arg(short, long)]
+ name: String,
+
+ /// Number of times to greet
+ #[arg(short, long, default_value_t = 1)]
+ count: u8,
+}
+
+fn main() {
+ let args = Args::parse();
+
+ for _ in 0..args.count {
+ println!("Hello {}!", args.name)
+ }
+}
diff --git a/third_party/rust/clap/examples/derive_ref/augment_args.rs b/third_party/rust/clap/examples/derive_ref/augment_args.rs
new file mode 100644
index 0000000000..39d837cfaf
--- /dev/null
+++ b/third_party/rust/clap/examples/derive_ref/augment_args.rs
@@ -0,0 +1,27 @@
+use clap::{arg, Args, Command, FromArgMatches as _};
+
+#[derive(Args, Debug)]
+struct DerivedArgs {
+ #[arg(short, long)]
+ derived: bool,
+}
+
+fn main() {
+ let cli = Command::new("CLI").arg(arg!(-b - -built).action(clap::ArgAction::SetTrue));
+ // Augment built args with derived args
+ let cli = DerivedArgs::augment_args(cli);
+
+ let matches = cli.get_matches();
+ println!("Value of built: {:?}", matches.get_flag("built"));
+ println!(
+ "Value of derived via ArgMatches: {:?}",
+ matches.get_flag("derived")
+ );
+
+ // Since DerivedArgs implements FromArgMatches, we can extract it from the unstructured ArgMatches.
+ // This is the main benefit of using derived arguments.
+ let derived_matches = DerivedArgs::from_arg_matches(&matches)
+ .map_err(|err| err.exit())
+ .unwrap();
+ println!("Value of derived: {derived_matches:#?}");
+}
diff --git a/third_party/rust/clap/examples/derive_ref/augment_subcommands.rs b/third_party/rust/clap/examples/derive_ref/augment_subcommands.rs
new file mode 100644
index 0000000000..51cbe75d2a
--- /dev/null
+++ b/third_party/rust/clap/examples/derive_ref/augment_subcommands.rs
@@ -0,0 +1,21 @@
+use clap::{Command, FromArgMatches as _, Parser, Subcommand as _};
+
+#[derive(Parser, Debug)]
+enum Subcommands {
+ Derived {
+ #[arg(short, long)]
+ derived_flag: bool,
+ },
+}
+
+fn main() {
+ let cli = Command::new("Built CLI");
+ // Augment with derived subcommands
+ let cli = Subcommands::augment_subcommands(cli);
+
+ let matches = cli.get_matches();
+ let derived_subcommands = Subcommands::from_arg_matches(&matches)
+ .map_err(|err| err.exit())
+ .unwrap();
+ println!("Derived subcommands: {derived_subcommands:#?}");
+}
diff --git a/third_party/rust/clap/examples/derive_ref/flatten_hand_args.rs b/third_party/rust/clap/examples/derive_ref/flatten_hand_args.rs
new file mode 100644
index 0000000000..36aac09323
--- /dev/null
+++ b/third_party/rust/clap/examples/derive_ref/flatten_hand_args.rs
@@ -0,0 +1,91 @@
+use clap::error::Error;
+use clap::{Arg, ArgAction, ArgMatches, Args, Command, FromArgMatches, Parser};
+
+#[derive(Debug)]
+struct CliArgs {
+ foo: bool,
+ bar: bool,
+ quuz: Option<String>,
+}
+
+impl FromArgMatches for CliArgs {
+ fn from_arg_matches(matches: &ArgMatches) -> Result<Self, Error> {
+ let mut matches = matches.clone();
+ Self::from_arg_matches_mut(&mut matches)
+ }
+ fn from_arg_matches_mut(matches: &mut ArgMatches) -> Result<Self, Error> {
+ Ok(Self {
+ foo: matches.get_flag("foo"),
+ bar: matches.get_flag("bar"),
+ quuz: matches.remove_one::<String>("quuz"),
+ })
+ }
+ fn update_from_arg_matches(&mut self, matches: &ArgMatches) -> Result<(), Error> {
+ let mut matches = matches.clone();
+ self.update_from_arg_matches_mut(&mut matches)
+ }
+ fn update_from_arg_matches_mut(&mut self, matches: &mut ArgMatches) -> Result<(), Error> {
+ self.foo |= matches.get_flag("foo");
+ self.bar |= matches.get_flag("bar");
+ if let Some(quuz) = matches.remove_one::<String>("quuz") {
+ self.quuz = Some(quuz);
+ }
+ Ok(())
+ }
+}
+
+impl Args for CliArgs {
+ fn augment_args(cmd: Command) -> Command {
+ cmd.arg(
+ Arg::new("foo")
+ .short('f')
+ .long("foo")
+ .action(ArgAction::SetTrue),
+ )
+ .arg(
+ Arg::new("bar")
+ .short('b')
+ .long("bar")
+ .action(ArgAction::SetTrue),
+ )
+ .arg(
+ Arg::new("quuz")
+ .short('q')
+ .long("quuz")
+ .action(ArgAction::Set),
+ )
+ }
+ fn augment_args_for_update(cmd: Command) -> Command {
+ cmd.arg(
+ Arg::new("foo")
+ .short('f')
+ .long("foo")
+ .action(ArgAction::SetTrue),
+ )
+ .arg(
+ Arg::new("bar")
+ .short('b')
+ .long("bar")
+ .action(ArgAction::SetTrue),
+ )
+ .arg(
+ Arg::new("quuz")
+ .short('q')
+ .long("quuz")
+ .action(ArgAction::Set),
+ )
+ }
+}
+
+#[derive(Parser, Debug)]
+struct Cli {
+ #[arg(short, long)]
+ top_level: bool,
+ #[command(flatten)]
+ more_args: CliArgs,
+}
+
+fn main() {
+ let args = Cli::parse();
+ println!("{args:#?}");
+}
diff --git a/third_party/rust/clap/examples/derive_ref/hand_subcommand.rs b/third_party/rust/clap/examples/derive_ref/hand_subcommand.rs
new file mode 100644
index 0000000000..ebaa60d5d2
--- /dev/null
+++ b/third_party/rust/clap/examples/derive_ref/hand_subcommand.rs
@@ -0,0 +1,79 @@
+use clap::error::{Error, ErrorKind};
+use clap::{ArgMatches, Args as _, Command, FromArgMatches, Parser, Subcommand};
+
+#[derive(Parser, Debug)]
+struct AddArgs {
+ name: Vec<String>,
+}
+#[derive(Parser, Debug)]
+struct RemoveArgs {
+ #[arg(short, long)]
+ force: bool,
+ name: Vec<String>,
+}
+
+#[derive(Debug)]
+enum CliSub {
+ Add(AddArgs),
+ Remove(RemoveArgs),
+}
+
+impl FromArgMatches for CliSub {
+ fn from_arg_matches(matches: &ArgMatches) -> Result<Self, Error> {
+ match matches.subcommand() {
+ Some(("add", args)) => Ok(Self::Add(AddArgs::from_arg_matches(args)?)),
+ Some(("remove", args)) => Ok(Self::Remove(RemoveArgs::from_arg_matches(args)?)),
+ Some((_, _)) => Err(Error::raw(
+ ErrorKind::InvalidSubcommand,
+ "Valid subcommands are `add` and `remove`",
+ )),
+ None => Err(Error::raw(
+ ErrorKind::MissingSubcommand,
+ "Valid subcommands are `add` and `remove`",
+ )),
+ }
+ }
+ fn update_from_arg_matches(&mut self, matches: &ArgMatches) -> Result<(), Error> {
+ match matches.subcommand() {
+ Some(("add", args)) => *self = Self::Add(AddArgs::from_arg_matches(args)?),
+ Some(("remove", args)) => *self = Self::Remove(RemoveArgs::from_arg_matches(args)?),
+ Some((_, _)) => {
+ return Err(Error::raw(
+ ErrorKind::InvalidSubcommand,
+ "Valid subcommands are `add` and `remove`",
+ ))
+ }
+ None => (),
+ };
+ Ok(())
+ }
+}
+
+impl Subcommand for CliSub {
+ fn augment_subcommands(cmd: Command) -> Command {
+ cmd.subcommand(AddArgs::augment_args(Command::new("add")))
+ .subcommand(RemoveArgs::augment_args(Command::new("remove")))
+ .subcommand_required(true)
+ }
+ fn augment_subcommands_for_update(cmd: Command) -> Command {
+ cmd.subcommand(AddArgs::augment_args(Command::new("add")))
+ .subcommand(RemoveArgs::augment_args(Command::new("remove")))
+ .subcommand_required(true)
+ }
+ fn has_subcommand(name: &str) -> bool {
+ matches!(name, "add" | "remove")
+ }
+}
+
+#[derive(Parser, Debug)]
+struct Cli {
+ #[arg(short, long)]
+ top_level: bool,
+ #[command(subcommand)]
+ subcommand: CliSub,
+}
+
+fn main() {
+ let args = Cli::parse();
+ println!("{args:#?}");
+}
diff --git a/third_party/rust/clap/examples/derive_ref/interop_tests.md b/third_party/rust/clap/examples/derive_ref/interop_tests.md
new file mode 100644
index 0000000000..b29e2d52d0
--- /dev/null
+++ b/third_party/rust/clap/examples/derive_ref/interop_tests.md
@@ -0,0 +1,248 @@
+Following are tests for the interop examples in this directory.
+
+## Augment Args
+
+```console
+$ interop_augment_args
+Value of built: false
+Value of derived via ArgMatches: false
+Value of derived: DerivedArgs {
+ derived: false,
+}
+
+```
+
+```console
+$ interop_augment_args -b --derived
+Value of built: true
+Value of derived via ArgMatches: true
+Value of derived: DerivedArgs {
+ derived: true,
+}
+
+```
+
+```console
+$ interop_augment_args -d --built
+Value of built: true
+Value of derived via ArgMatches: true
+Value of derived: DerivedArgs {
+ derived: true,
+}
+
+```
+
+```console
+$ interop_augment_args --unknown
+? failed
+error: unexpected argument '--unknown' found
+
+Usage: interop_augment_args[EXE] [OPTIONS]
+
+For more information, try '--help'.
+
+```
+
+## Augment Subcommands
+
+```console
+$ interop_augment_subcommands
+? failed
+error: A subcommand is required but one was not provided.
+```
+
+```console
+$ interop_augment_subcommands derived
+Derived subcommands: Derived {
+ derived_flag: false,
+}
+
+```
+
+```console
+$ interop_augment_subcommands derived --derived-flag
+Derived subcommands: Derived {
+ derived_flag: true,
+}
+
+```
+
+```console
+$ interop_augment_subcommands derived --unknown
+? failed
+error: unexpected argument '--unknown' found
+
+Usage: interop_augment_subcommands[EXE] derived [OPTIONS]
+
+For more information, try '--help'.
+
+```
+
+```console
+$ interop_augment_subcommands unknown
+? failed
+error: unrecognized subcommand 'unknown'
+
+Usage: interop_augment_subcommands[EXE] [COMMAND]
+
+For more information, try '--help'.
+
+```
+
+## Hand-Implemented Subcommand
+
+```console
+$ interop_hand_subcommand
+? failed
+Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
+
+Commands:
+ add
+ remove
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -t, --top-level
+ -h, --help Print help
+
+```
+
+```console
+$ interop_hand_subcommand add
+Cli {
+ top_level: false,
+ subcommand: Add(
+ AddArgs {
+ name: [],
+ },
+ ),
+}
+
+```
+
+```console
+$ interop_hand_subcommand add a b c
+Cli {
+ top_level: false,
+ subcommand: Add(
+ AddArgs {
+ name: [
+ "a",
+ "b",
+ "c",
+ ],
+ },
+ ),
+}
+
+```
+
+```console
+$ interop_hand_subcommand add --unknown
+? failed
+error: unexpected argument '--unknown' found
+
+ tip: to pass '--unknown' as a value, use '-- --unknown'
+
+Usage: interop_hand_subcommand[EXE] add [NAME]...
+
+For more information, try '--help'.
+
+```
+
+```console
+$ interop_hand_subcommand remove
+Cli {
+ top_level: false,
+ subcommand: Remove(
+ RemoveArgs {
+ force: false,
+ name: [],
+ },
+ ),
+}
+
+```
+
+```console
+$ interop_hand_subcommand remove --force a b c
+Cli {
+ top_level: false,
+ subcommand: Remove(
+ RemoveArgs {
+ force: true,
+ name: [
+ "a",
+ "b",
+ "c",
+ ],
+ },
+ ),
+}
+
+```
+
+```console
+$ interop_hand_subcommand unknown
+? failed
+error: unrecognized subcommand 'unknown'
+
+Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>
+
+For more information, try '--help'.
+
+```
+
+## Flatten Hand-Implemented Args
+
+```console
+$ interop_flatten_hand_args
+Cli {
+ top_level: false,
+ more_args: CliArgs {
+ foo: false,
+ bar: false,
+ quuz: None,
+ },
+}
+
+```
+
+```console
+$ interop_flatten_hand_args -f --bar
+Cli {
+ top_level: false,
+ more_args: CliArgs {
+ foo: true,
+ bar: true,
+ quuz: None,
+ },
+}
+
+```
+
+```console
+$ interop_flatten_hand_args --quuz abc
+Cli {
+ top_level: false,
+ more_args: CliArgs {
+ foo: false,
+ bar: false,
+ quuz: Some(
+ "abc",
+ ),
+ },
+}
+
+```
+
+```console
+$ interop_flatten_hand_args --unknown
+? failed
+error: unexpected argument '--unknown' found
+
+Usage: interop_flatten_hand_args[EXE] [OPTIONS]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/escaped-positional-derive.md b/third_party/rust/clap/examples/escaped-positional-derive.md
new file mode 100644
index 0000000000..82990b59f1
--- /dev/null
+++ b/third_party/rust/clap/examples/escaped-positional-derive.md
@@ -0,0 +1,60 @@
+**This requires enabling the [`derive` feature flag][crate::_features].**
+
+You can use `--` to escape further arguments.
+
+Let's see what this looks like in the help:
+```console
+$ escaped-positional-derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
+
+Arguments:
+ [SLOP]...
+
+Options:
+ -f
+ -p <PEAR>
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Here is a baseline without any arguments:
+```console
+$ escaped-positional-derive
+-f used: false
+-p's value: None
+'slops' values: []
+
+```
+
+Notice that we can't pass positional arguments before `--`:
+```console
+$ escaped-positional-derive foo bar
+? failed
+error: unexpected argument 'foo' found
+
+Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]
+
+For more information, try '--help'.
+
+```
+
+But you can after:
+```console
+$ escaped-positional-derive -f -p=bob -- sloppy slop slop
+-f used: true
+-p's value: Some("bob")
+'slops' values: ["sloppy", "slop", "slop"]
+
+```
+
+As mentioned, the parser will directly pass everything through:
+```console
+$ escaped-positional-derive -- -f -p=bob sloppy slop slop
+-f used: false
+-p's value: None
+'slops' values: ["-f", "-p=bob", "sloppy", "slop", "slop"]
+
+```
diff --git a/third_party/rust/clap/examples/escaped-positional-derive.rs b/third_party/rust/clap/examples/escaped-positional-derive.rs
new file mode 100644
index 0000000000..719b3d6c21
--- /dev/null
+++ b/third_party/rust/clap/examples/escaped-positional-derive.rs
@@ -0,0 +1,25 @@
+use clap::Parser;
+
+#[derive(Parser)] // requires `derive` feature
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(short = 'f')]
+ eff: bool,
+
+ #[arg(short = 'p', value_name = "PEAR")]
+ pea: Option<String>,
+
+ #[arg(last = true)]
+ slop: Vec<String>,
+}
+
+fn main() {
+ let args = Cli::parse();
+
+ // This is what will happen with `myprog -f -p=bob -- sloppy slop slop`...
+ println!("-f used: {:?}", args.eff); // -f used: true
+ println!("-p's value: {:?}", args.pea); // -p's value: Some("bob")
+ println!("'slops' values: {:?}", args.slop); // 'slops' values: Some(["sloppy", "slop", "slop"])
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/escaped-positional.md b/third_party/rust/clap/examples/escaped-positional.md
new file mode 100644
index 0000000000..d94e3993c8
--- /dev/null
+++ b/third_party/rust/clap/examples/escaped-positional.md
@@ -0,0 +1,60 @@
+**This requires enabling the [`cargo` feature flag][crate::_features].**
+
+You can use `--` to escape further arguments.
+
+Let's see what this looks like in the help:
+```console
+$ escaped-positional --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
+
+Arguments:
+ [SLOP]...
+
+Options:
+ -f
+ -p <PEAR>
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Here is a baseline without any arguments:
+```console
+$ escaped-positional
+-f used: false
+-p's value: None
+'slops' values: []
+
+```
+
+Notice that we can't pass positional arguments before `--`:
+```console
+$ escaped-positional foo bar
+? failed
+error: unexpected argument 'foo' found
+
+Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]
+
+For more information, try '--help'.
+
+```
+
+But you can after:
+```console
+$ escaped-positional -f -p=bob -- sloppy slop slop
+-f used: true
+-p's value: Some("bob")
+'slops' values: ["sloppy", "slop", "slop"]
+
+```
+
+As mentioned, the parser will directly pass everything through:
+```console
+$ escaped-positional -- -f -p=bob sloppy slop slop
+-f used: false
+-p's value: None
+'slops' values: ["-f", "-p=bob", "sloppy", "slop", "slop"]
+
+```
diff --git a/third_party/rust/clap/examples/escaped-positional.rs b/third_party/rust/clap/examples/escaped-positional.rs
new file mode 100644
index 0000000000..d107e47db4
--- /dev/null
+++ b/third_party/rust/clap/examples/escaped-positional.rs
@@ -0,0 +1,32 @@
+use clap::{arg, command, value_parser, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(arg!(eff: -f).action(ArgAction::SetTrue))
+ .arg(arg!(pea: -p <PEAR>).value_parser(value_parser!(String)))
+ .arg(
+ // Indicates that `slop` is only accessible after `--`.
+ arg!(slop: [SLOP])
+ .num_args(1..)
+ .last(true)
+ .value_parser(value_parser!(String)),
+ )
+ .get_matches();
+
+ // This is what will happen with `myprog -f -p=bob -- sloppy slop slop`...
+
+ // -f used: true
+ println!("-f used: {:?}", matches.get_flag("eff"));
+ // -p's value: Some("bob")
+ println!("-p's value: {:?}", matches.get_one::<String>("pea"));
+ // 'slops' values: Some(["sloppy", "slop", "slop"])
+ println!(
+ "'slops' values: {:?}",
+ matches
+ .get_many::<String>("slop")
+ .map(|vals| vals.collect::<Vec<_>>())
+ .unwrap_or_default()
+ );
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/find.md b/third_party/rust/clap/examples/find.md
new file mode 100644
index 0000000000..e9b1a86f89
--- /dev/null
+++ b/third_party/rust/clap/examples/find.md
@@ -0,0 +1,45 @@
+`find` is an example of position-sensitive flags
+
+```console
+$ find --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: find[EXE] [OPTIONS]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+TESTS:
+ --empty File is empty and is either a regular file or a directory
+ --name <NAME> Base of file name (the path with the leading directories removed) matches shell
+ pattern pattern
+
+OPERATORS:
+ -o, --or expr2 is not evaluate if exp1 is true
+ -a, --and Same as `expr1 expr1`
+
+$ find --empty -o --name .keep
+[
+ (
+ "empty",
+ Bool(
+ true,
+ ),
+ ),
+ (
+ "or",
+ Bool(
+ true,
+ ),
+ ),
+ (
+ "name",
+ String(
+ ".keep",
+ ),
+ ),
+]
+
+```
+
diff --git a/third_party/rust/clap/examples/find.rs b/third_party/rust/clap/examples/find.rs
new file mode 100644
index 0000000000..0b7f2c7000
--- /dev/null
+++ b/third_party/rust/clap/examples/find.rs
@@ -0,0 +1,99 @@
+use std::collections::BTreeMap;
+
+use clap::{arg, command, ArgGroup, ArgMatches, Command};
+
+fn main() {
+ let matches = cli().get_matches();
+ let values = Value::from_matches(&matches);
+ println!("{values:#?}");
+}
+
+fn cli() -> Command {
+ command!()
+ .group(ArgGroup::new("tests").multiple(true))
+ .next_help_heading("TESTS")
+ .args([
+ arg!(--empty "File is empty and is either a regular file or a directory").group("tests"),
+ arg!(--name <NAME> "Base of file name (the path with the leading directories removed) matches shell pattern pattern").group("tests"),
+ ])
+ .group(ArgGroup::new("operators").multiple(true))
+ .next_help_heading("OPERATORS")
+ .args([
+ arg!(-o - -or "expr2 is not evaluate if exp1 is true").group("operators"),
+ arg!(-a - -and "Same as `expr1 expr1`").group("operators"),
+ ])
+}
+
+#[derive(Clone, PartialEq, Eq, Hash, Debug)]
+pub enum Value {
+ Bool(bool),
+ String(String),
+}
+
+impl Value {
+ pub fn from_matches(matches: &ArgMatches) -> Vec<(clap::Id, Self)> {
+ let mut values = BTreeMap::new();
+ for id in matches.ids() {
+ if matches.try_get_many::<clap::Id>(id.as_str()).is_ok() {
+ // ignore groups
+ continue;
+ }
+ let value_source = matches
+ .value_source(id.as_str())
+ .expect("id came from matches");
+ if value_source != clap::parser::ValueSource::CommandLine {
+ // Any other source just gets tacked on at the end (like default values)
+ continue;
+ }
+ if Self::extract::<String>(matches, id, &mut values) {
+ continue;
+ }
+ if Self::extract::<bool>(matches, id, &mut values) {
+ continue;
+ }
+ unimplemented!("unknown type for {id}: {matches:?}");
+ }
+ values.into_values().collect::<Vec<_>>()
+ }
+
+ fn extract<T: Clone + Into<Value> + Send + Sync + 'static>(
+ matches: &ArgMatches,
+ id: &clap::Id,
+ output: &mut BTreeMap<usize, (clap::Id, Self)>,
+ ) -> bool {
+ match matches.try_get_many::<T>(id.as_str()) {
+ Ok(Some(values)) => {
+ for (value, index) in values.zip(
+ matches
+ .indices_of(id.as_str())
+ .expect("id came from matches"),
+ ) {
+ output.insert(index, (id.clone(), value.clone().into()));
+ }
+ true
+ }
+ Ok(None) => {
+ unreachable!("`ids` only reports what is present")
+ }
+ Err(clap::parser::MatchesError::UnknownArgument { .. }) => {
+ unreachable!("id came from matches")
+ }
+ Err(clap::parser::MatchesError::Downcast { .. }) => false,
+ Err(_) => {
+ unreachable!("id came from matches")
+ }
+ }
+ }
+}
+
+impl From<String> for Value {
+ fn from(other: String) -> Self {
+ Self::String(other)
+ }
+}
+
+impl From<bool> for Value {
+ fn from(other: bool) -> Self {
+ Self::Bool(other)
+ }
+}
diff --git a/third_party/rust/clap/examples/git-derive.md b/third_party/rust/clap/examples/git-derive.md
new file mode 100644
index 0000000000..57edb612e9
--- /dev/null
+++ b/third_party/rust/clap/examples/git-derive.md
@@ -0,0 +1,159 @@
+**This requires enabling the [`derive` feature flag][crate::_features].**
+
+Git is an example of several common subcommand patterns.
+
+Help:
+```console
+$ git-derive
+? failed
+A fictional versioning CLI
+
+Usage: git-derive[EXE] <COMMAND>
+
+Commands:
+ clone Clones repos
+ diff Compare two commits
+ push pushes things
+ add adds things
+ stash
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ git-derive help
+A fictional versioning CLI
+
+Usage: git-derive[EXE] <COMMAND>
+
+Commands:
+ clone Clones repos
+ diff Compare two commits
+ push pushes things
+ add adds things
+ stash
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ git-derive help add
+adds things
+
+Usage: git-derive[EXE] add <PATH>...
+
+Arguments:
+ <PATH>... Stuff to add
+
+Options:
+ -h, --help Print help
+
+```
+
+A basic argument:
+```console
+$ git-derive add
+? failed
+adds things
+
+Usage: git-derive[EXE] add <PATH>...
+
+Arguments:
+ <PATH>... Stuff to add
+
+Options:
+ -h, --help Print help
+
+$ git-derive add Cargo.toml Cargo.lock
+Adding ["Cargo.toml", "Cargo.lock"]
+
+```
+
+Default subcommand:
+```console
+$ git-derive stash -h
+Usage: git-derive[EXE] stash [OPTIONS]
+ git-derive[EXE] stash <COMMAND>
+
+Commands:
+ push
+ pop
+ apply
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -m, --message <MESSAGE>
+ -h, --help Print help
+
+$ git-derive stash push -h
+Usage: git-derive[EXE] stash push [OPTIONS]
+
+Options:
+ -m, --message <MESSAGE>
+ -h, --help Print help
+
+$ git-derive stash pop -h
+Usage: git-derive[EXE] stash pop [STASH]
+
+Arguments:
+ [STASH]
+
+Options:
+ -h, --help Print help
+
+$ git-derive stash -m "Prototype"
+Pushing StashPushArgs { message: Some("Prototype") }
+
+$ git-derive stash pop
+Popping None
+
+$ git-derive stash push -m "Prototype"
+Pushing StashPushArgs { message: Some("Prototype") }
+
+$ git-derive stash pop
+Popping None
+
+```
+
+External subcommands:
+```console
+$ git-derive custom-tool arg1 --foo bar
+Calling out to "custom-tool" with ["arg1", "--foo", "bar"]
+
+```
+
+Last argument:
+```console
+$ git-derive diff --help
+Compare two commits
+
+Usage: git-derive[EXE] diff [OPTIONS] [COMMIT] [COMMIT] [-- <PATH>]
+
+Arguments:
+ [COMMIT]
+ [COMMIT]
+ [PATH]
+
+Options:
+ --color[=<WHEN>] [default: auto] [possible values: always, auto, never]
+ -h, --help Print help
+
+$ git-derive diff
+Diffing stage..worktree (color=auto)
+
+$ git-derive diff ./src
+Diffing stage..worktree ./src (color=auto)
+
+$ git-derive diff HEAD ./src
+Diffing HEAD..worktree ./src (color=auto)
+
+$ git-derive diff HEAD~~ -- HEAD
+Diffing HEAD~~..worktree HEAD (color=auto)
+
+$ git-derive diff --color
+Diffing stage..worktree (color=always)
+
+$ git-derive diff --color=never
+Diffing stage..worktree (color=never)
+
+```
diff --git a/third_party/rust/clap/examples/git-derive.rs b/third_party/rust/clap/examples/git-derive.rs
new file mode 100644
index 0000000000..ad82e0cea7
--- /dev/null
+++ b/third_party/rust/clap/examples/git-derive.rs
@@ -0,0 +1,164 @@
+use std::ffi::OsStr;
+use std::ffi::OsString;
+use std::path::PathBuf;
+
+use clap::{Args, Parser, Subcommand, ValueEnum};
+
+/// A fictional versioning CLI
+#[derive(Debug, Parser)] // requires `derive` feature
+#[command(name = "git")]
+#[command(about = "A fictional versioning CLI", long_about = None)]
+struct Cli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Debug, Subcommand)]
+enum Commands {
+ /// Clones repos
+ #[command(arg_required_else_help = true)]
+ Clone {
+ /// The remote to clone
+ remote: String,
+ },
+ /// Compare two commits
+ Diff {
+ #[arg(value_name = "COMMIT")]
+ base: Option<OsString>,
+ #[arg(value_name = "COMMIT")]
+ head: Option<OsString>,
+ #[arg(last = true)]
+ path: Option<OsString>,
+ #[arg(
+ long,
+ require_equals = true,
+ value_name = "WHEN",
+ num_args = 0..=1,
+ default_value_t = ColorWhen::Auto,
+ default_missing_value = "always",
+ value_enum
+ )]
+ color: ColorWhen,
+ },
+ /// pushes things
+ #[command(arg_required_else_help = true)]
+ Push {
+ /// The remote to target
+ remote: String,
+ },
+ /// adds things
+ #[command(arg_required_else_help = true)]
+ Add {
+ /// Stuff to add
+ #[arg(required = true)]
+ path: Vec<PathBuf>,
+ },
+ Stash(StashArgs),
+ #[command(external_subcommand)]
+ External(Vec<OsString>),
+}
+
+#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
+enum ColorWhen {
+ Always,
+ Auto,
+ Never,
+}
+
+impl std::fmt::Display for ColorWhen {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ self.to_possible_value()
+ .expect("no values are skipped")
+ .get_name()
+ .fmt(f)
+ }
+}
+
+#[derive(Debug, Args)]
+#[command(args_conflicts_with_subcommands = true)]
+struct StashArgs {
+ #[command(subcommand)]
+ command: Option<StashCommands>,
+
+ #[command(flatten)]
+ push: StashPushArgs,
+}
+
+#[derive(Debug, Subcommand)]
+enum StashCommands {
+ Push(StashPushArgs),
+ Pop { stash: Option<String> },
+ Apply { stash: Option<String> },
+}
+
+#[derive(Debug, Args)]
+struct StashPushArgs {
+ #[arg(short, long)]
+ message: Option<String>,
+}
+
+fn main() {
+ let args = Cli::parse();
+
+ match args.command {
+ Commands::Clone { remote } => {
+ println!("Cloning {remote}");
+ }
+ Commands::Diff {
+ mut base,
+ mut head,
+ mut path,
+ color,
+ } => {
+ if path.is_none() {
+ path = head;
+ head = None;
+ if path.is_none() {
+ path = base;
+ base = None;
+ }
+ }
+ let base = base
+ .as_deref()
+ .map(|s| s.to_str().unwrap())
+ .unwrap_or("stage");
+ let head = head
+ .as_deref()
+ .map(|s| s.to_str().unwrap())
+ .unwrap_or("worktree");
+ let path = path.as_deref().unwrap_or_else(|| OsStr::new(""));
+ println!(
+ "Diffing {}..{} {} (color={})",
+ base,
+ head,
+ path.to_string_lossy(),
+ color
+ );
+ }
+ Commands::Push { remote } => {
+ println!("Pushing to {remote}");
+ }
+ Commands::Add { path } => {
+ println!("Adding {path:?}");
+ }
+ Commands::Stash(stash) => {
+ let stash_cmd = stash.command.unwrap_or(StashCommands::Push(stash.push));
+ match stash_cmd {
+ StashCommands::Push(push) => {
+ println!("Pushing {push:?}");
+ }
+ StashCommands::Pop { stash } => {
+ println!("Popping {stash:?}");
+ }
+ StashCommands::Apply { stash } => {
+ println!("Applying {stash:?}");
+ }
+ }
+ }
+ Commands::External(args) => {
+ println!("Calling out to {:?} with {:?}", &args[0], &args[1..]);
+ }
+ }
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/git.md b/third_party/rust/clap/examples/git.md
new file mode 100644
index 0000000000..d90b2e8e05
--- /dev/null
+++ b/third_party/rust/clap/examples/git.md
@@ -0,0 +1,157 @@
+Git is an example of several common subcommand patterns.
+
+Help:
+```console
+$ git
+? failed
+A fictional versioning CLI
+
+Usage: git[EXE] <COMMAND>
+
+Commands:
+ clone Clones repos
+ diff Compare two commits
+ push pushes things
+ add adds things
+ stash
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ git help
+A fictional versioning CLI
+
+Usage: git[EXE] <COMMAND>
+
+Commands:
+ clone Clones repos
+ diff Compare two commits
+ push pushes things
+ add adds things
+ stash
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+
+$ git help add
+adds things
+
+Usage: git[EXE] add <PATH>...
+
+Arguments:
+ <PATH>... Stuff to add
+
+Options:
+ -h, --help Print help
+
+```
+
+A basic argument:
+```console
+$ git add
+? failed
+adds things
+
+Usage: git[EXE] add <PATH>...
+
+Arguments:
+ <PATH>... Stuff to add
+
+Options:
+ -h, --help Print help
+
+$ git add Cargo.toml Cargo.lock
+Adding ["Cargo.toml", "Cargo.lock"]
+
+```
+
+Default subcommand:
+```console
+$ git stash -h
+Usage: git[EXE] stash [OPTIONS]
+ git[EXE] stash <COMMAND>
+
+Commands:
+ push
+ pop
+ apply
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -m, --message <MESSAGE>
+ -h, --help Print help
+
+$ git stash push -h
+Usage: git[EXE] stash push [OPTIONS]
+
+Options:
+ -m, --message <MESSAGE>
+ -h, --help Print help
+
+$ git stash pop -h
+Usage: git[EXE] stash pop [STASH]
+
+Arguments:
+ [STASH]
+
+Options:
+ -h, --help Print help
+
+$ git stash -m "Prototype"
+Pushing Some("Prototype")
+
+$ git stash pop
+Popping None
+
+$ git stash push -m "Prototype"
+Pushing Some("Prototype")
+
+$ git stash pop
+Popping None
+
+```
+
+External subcommands:
+```console
+$ git custom-tool arg1 --foo bar
+Calling out to "custom-tool" with ["arg1", "--foo", "bar"]
+
+```
+
+Last argument:
+```console
+$ git diff --help
+Compare two commits
+
+Usage: git[EXE] diff [OPTIONS] [COMMIT] [COMMIT] [-- <PATH>]
+
+Arguments:
+ [COMMIT]
+ [COMMIT]
+ [PATH]
+
+Options:
+ --color[=<WHEN>] [default: auto] [possible values: always, auto, never]
+ -h, --help Print help
+
+$ git diff
+Diffing stage..worktree (color=auto)
+
+$ git diff ./src
+Diffing stage..worktree ./src (color=auto)
+
+$ git diff HEAD ./src
+Diffing HEAD..worktree ./src (color=auto)
+
+$ git diff HEAD~~ -- HEAD
+Diffing HEAD~~..worktree HEAD (color=auto)
+
+$ git diff --color
+Diffing stage..worktree (color=always)
+
+$ git diff --color=never
+Diffing stage..worktree (color=never)
+
+```
diff --git a/third_party/rust/clap/examples/git.rs b/third_party/rust/clap/examples/git.rs
new file mode 100644
index 0000000000..02173675f9
--- /dev/null
+++ b/third_party/rust/clap/examples/git.rs
@@ -0,0 +1,137 @@
+use std::ffi::OsString;
+use std::path::PathBuf;
+
+use clap::{arg, Command};
+
+fn cli() -> Command {
+ Command::new("git")
+ .about("A fictional versioning CLI")
+ .subcommand_required(true)
+ .arg_required_else_help(true)
+ .allow_external_subcommands(true)
+ .subcommand(
+ Command::new("clone")
+ .about("Clones repos")
+ .arg(arg!(<REMOTE> "The remote to clone"))
+ .arg_required_else_help(true),
+ )
+ .subcommand(
+ Command::new("diff")
+ .about("Compare two commits")
+ .arg(arg!(base: [COMMIT]))
+ .arg(arg!(head: [COMMIT]))
+ .arg(arg!(path: [PATH]).last(true))
+ .arg(
+ arg!(--color <WHEN>)
+ .value_parser(["always", "auto", "never"])
+ .num_args(0..=1)
+ .require_equals(true)
+ .default_value("auto")
+ .default_missing_value("always"),
+ ),
+ )
+ .subcommand(
+ Command::new("push")
+ .about("pushes things")
+ .arg(arg!(<REMOTE> "The remote to target"))
+ .arg_required_else_help(true),
+ )
+ .subcommand(
+ Command::new("add")
+ .about("adds things")
+ .arg_required_else_help(true)
+ .arg(arg!(<PATH> ... "Stuff to add").value_parser(clap::value_parser!(PathBuf))),
+ )
+ .subcommand(
+ Command::new("stash")
+ .args_conflicts_with_subcommands(true)
+ .args(push_args())
+ .subcommand(Command::new("push").args(push_args()))
+ .subcommand(Command::new("pop").arg(arg!([STASH])))
+ .subcommand(Command::new("apply").arg(arg!([STASH]))),
+ )
+}
+
+fn push_args() -> Vec<clap::Arg> {
+ vec![arg!(-m --message <MESSAGE>)]
+}
+
+fn main() {
+ let matches = cli().get_matches();
+
+ match matches.subcommand() {
+ Some(("clone", sub_matches)) => {
+ println!(
+ "Cloning {}",
+ sub_matches.get_one::<String>("REMOTE").expect("required")
+ );
+ }
+ Some(("diff", sub_matches)) => {
+ let color = sub_matches
+ .get_one::<String>("color")
+ .map(|s| s.as_str())
+ .expect("defaulted in clap");
+
+ let mut base = sub_matches.get_one::<String>("base").map(|s| s.as_str());
+ let mut head = sub_matches.get_one::<String>("head").map(|s| s.as_str());
+ let mut path = sub_matches.get_one::<String>("path").map(|s| s.as_str());
+ if path.is_none() {
+ path = head;
+ head = None;
+ if path.is_none() {
+ path = base;
+ base = None;
+ }
+ }
+ let base = base.unwrap_or("stage");
+ let head = head.unwrap_or("worktree");
+ let path = path.unwrap_or("");
+ println!("Diffing {base}..{head} {path} (color={color})");
+ }
+ Some(("push", sub_matches)) => {
+ println!(
+ "Pushing to {}",
+ sub_matches.get_one::<String>("REMOTE").expect("required")
+ );
+ }
+ Some(("add", sub_matches)) => {
+ let paths = sub_matches
+ .get_many::<PathBuf>("PATH")
+ .into_iter()
+ .flatten()
+ .collect::<Vec<_>>();
+ println!("Adding {paths:?}");
+ }
+ Some(("stash", sub_matches)) => {
+ let stash_command = sub_matches.subcommand().unwrap_or(("push", sub_matches));
+ match stash_command {
+ ("apply", sub_matches) => {
+ let stash = sub_matches.get_one::<String>("STASH");
+ println!("Applying {stash:?}");
+ }
+ ("pop", sub_matches) => {
+ let stash = sub_matches.get_one::<String>("STASH");
+ println!("Popping {stash:?}");
+ }
+ ("push", sub_matches) => {
+ let message = sub_matches.get_one::<String>("message");
+ println!("Pushing {message:?}");
+ }
+ (name, _) => {
+ unreachable!("Unsupported subcommand `{name}`")
+ }
+ }
+ }
+ Some((ext, sub_matches)) => {
+ let args = sub_matches
+ .get_many::<OsString>("")
+ .into_iter()
+ .flatten()
+ .collect::<Vec<_>>();
+ println!("Calling out to {ext:?} with {args:?}");
+ }
+ _ => unreachable!(), // If all subcommands are defined above, anything else is unreachable!()
+ }
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/multicall-busybox.md b/third_party/rust/clap/examples/multicall-busybox.md
new file mode 100644
index 0000000000..e84b263514
--- /dev/null
+++ b/third_party/rust/clap/examples/multicall-busybox.md
@@ -0,0 +1,39 @@
+See the documentation for [`Command::multicall`][crate::Command::multicall] for rationale.
+
+This example omits every command except true and false,
+which are the most trivial to implement,
+```console
+$ busybox true
+? 0
+
+$ busybox false
+? 1
+
+```
+*Note: without the links setup, we can't demonstrate the multicall behavior*
+
+But includes the `--install` option as an example of why it can be useful
+for the main program to take arguments that aren't applet subcommands.
+```console
+$ busybox --install
+? failed
+...
+
+```
+
+Though users must pass something:
+```console
+$ busybox
+? failed
+Usage: busybox [OPTIONS] [APPLET]
+
+APPLETS:
+ true does nothing successfully
+ false does nothing unsuccessfully
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ --install <install> Install hardlinks for all subcommands in path
+ -h, --help Print help
+
+```
diff --git a/third_party/rust/clap/examples/multicall-busybox.rs b/third_party/rust/clap/examples/multicall-busybox.rs
new file mode 100644
index 0000000000..9260e1d70e
--- /dev/null
+++ b/third_party/rust/clap/examples/multicall-busybox.rs
@@ -0,0 +1,47 @@
+use std::path::PathBuf;
+use std::process::exit;
+
+use clap::{value_parser, Arg, ArgAction, Command};
+
+fn applet_commands() -> [Command; 2] {
+ [
+ Command::new("true").about("does nothing successfully"),
+ Command::new("false").about("does nothing unsuccessfully"),
+ ]
+}
+
+fn main() {
+ let cmd = Command::new(env!("CARGO_CRATE_NAME"))
+ .multicall(true)
+ .subcommand(
+ Command::new("busybox")
+ .arg_required_else_help(true)
+ .subcommand_value_name("APPLET")
+ .subcommand_help_heading("APPLETS")
+ .arg(
+ Arg::new("install")
+ .long("install")
+ .help("Install hardlinks for all subcommands in path")
+ .exclusive(true)
+ .action(ArgAction::Set)
+ .default_missing_value("/usr/local/bin")
+ .value_parser(value_parser!(PathBuf)),
+ )
+ .subcommands(applet_commands()),
+ )
+ .subcommands(applet_commands());
+
+ let matches = cmd.get_matches();
+ let mut subcommand = matches.subcommand();
+ if let Some(("busybox", cmd)) = subcommand {
+ if cmd.contains_id("install") {
+ unimplemented!("Make hardlinks to the executable here");
+ }
+ subcommand = cmd.subcommand();
+ }
+ match subcommand {
+ Some(("false", _)) => exit(1),
+ Some(("true", _)) => exit(0),
+ _ => unreachable!("parser should ensure only valid subcommand names are used"),
+ }
+}
diff --git a/third_party/rust/clap/examples/multicall-hostname.md b/third_party/rust/clap/examples/multicall-hostname.md
new file mode 100644
index 0000000000..0df1274e15
--- /dev/null
+++ b/third_party/rust/clap/examples/multicall-hostname.md
@@ -0,0 +1,10 @@
+See the documentation for [`Command::multicall`][crate::Command::multicall] for rationale.
+
+This example omits the implementation of displaying address config
+
+```console
+$ hostname
+www
+
+```
+*Note: without the links setup, we can't demonstrate the multicall behavior*
diff --git a/third_party/rust/clap/examples/multicall-hostname.rs b/third_party/rust/clap/examples/multicall-hostname.rs
new file mode 100644
index 0000000000..b57680a5c1
--- /dev/null
+++ b/third_party/rust/clap/examples/multicall-hostname.rs
@@ -0,0 +1,17 @@
+use clap::Command;
+
+fn main() {
+ let cmd = Command::new(env!("CARGO_CRATE_NAME"))
+ .multicall(true)
+ .arg_required_else_help(true)
+ .subcommand_value_name("APPLET")
+ .subcommand_help_heading("APPLETS")
+ .subcommand(Command::new("hostname").about("show hostname part of FQDN"))
+ .subcommand(Command::new("dnsdomainname").about("show domain name part of FQDN"));
+
+ match cmd.get_matches().subcommand_name() {
+ Some("hostname") => println!("www"),
+ Some("dnsdomainname") => println!("example.com"),
+ _ => unreachable!("parser should ensure only valid subcommand names are used"),
+ }
+}
diff --git a/third_party/rust/clap/examples/pacman.md b/third_party/rust/clap/examples/pacman.md
new file mode 100644
index 0000000000..b02cf8f1be
--- /dev/null
+++ b/third_party/rust/clap/examples/pacman.md
@@ -0,0 +1,79 @@
+[`pacman`](https://wiki.archlinux.org/index.php/pacman) defines subcommands via flags.
+
+Here, `-S` is a short flag subcommand:
+```console
+$ pacman -S package
+Installing package...
+
+```
+
+Here `--sync` is a long flag subcommand:
+```console
+$ pacman --sync package
+Installing package...
+
+```
+
+Now the short flag subcommand (`-S`) with a long flag:
+```console
+$ pacman -S --search name
+Searching for name...
+
+```
+
+And the various forms of short flags that work:
+```console
+$ pacman -S -s name
+Searching for name...
+
+$ pacman -Ss name
+Searching for name...
+
+```
+*(users can "stack" short subcommands with short flags or with other short flag subcommands)*
+
+In the help, this looks like:
+```console
+$ pacman -h
+package manager utility
+
+Usage: pacman[EXE] <COMMAND>
+
+Commands:
+ query, -Q, --query Query the package database.
+ sync, -S, --sync Synchronize packages.
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ pacman -S -h
+Synchronize packages.
+
+Usage: pacman[EXE] {sync|--sync|-S} [OPTIONS] [package]...
+
+Arguments:
+ [package]... packages
+
+Options:
+ -s, --search <search>... search remote repositories for matching strings
+ -i, --info view package information
+ -h, --help Print help
+
+```
+
+And errors:
+```console
+$ pacman -S -s foo -i bar
+? failed
+error: the argument '--search <search>...' cannot be used with '--info'
+
+Usage: pacman[EXE] {sync|--sync|-S} --search <search>... <package>...
+
+For more information, try '--help'.
+
+```
+
+**NOTE:** Keep in mind that subcommands, flags, and long flags are *case sensitive*: `-Q` and `-q` are different flags/subcommands. For example, you can have both `-Q` subcommand and `-q` flag, and they will be properly disambiguated.
+Let's make a quick program to illustrate.
diff --git a/third_party/rust/clap/examples/pacman.rs b/third_party/rust/clap/examples/pacman.rs
new file mode 100644
index 0000000000..7ab30db953
--- /dev/null
+++ b/third_party/rust/clap/examples/pacman.rs
@@ -0,0 +1,111 @@
+use clap::{Arg, ArgAction, Command};
+
+fn main() {
+ let matches = Command::new("pacman")
+ .about("package manager utility")
+ .version("5.2.1")
+ .subcommand_required(true)
+ .arg_required_else_help(true)
+ .author("Pacman Development Team")
+ // Query subcommand
+ //
+ // Only a few of its arguments are implemented below.
+ .subcommand(
+ Command::new("query")
+ .short_flag('Q')
+ .long_flag("query")
+ .about("Query the package database.")
+ .arg(
+ Arg::new("search")
+ .short('s')
+ .long("search")
+ .help("search locally installed packages for matching strings")
+ .conflicts_with("info")
+ .action(ArgAction::Set)
+ .num_args(1..),
+ )
+ .arg(
+ Arg::new("info")
+ .long("info")
+ .short('i')
+ .conflicts_with("search")
+ .help("view package information")
+ .action(ArgAction::Set)
+ .num_args(1..),
+ ),
+ )
+ // Sync subcommand
+ //
+ // Only a few of its arguments are implemented below.
+ .subcommand(
+ Command::new("sync")
+ .short_flag('S')
+ .long_flag("sync")
+ .about("Synchronize packages.")
+ .arg(
+ Arg::new("search")
+ .short('s')
+ .long("search")
+ .conflicts_with("info")
+ .action(ArgAction::Set)
+ .num_args(1..)
+ .help("search remote repositories for matching strings"),
+ )
+ .arg(
+ Arg::new("info")
+ .long("info")
+ .conflicts_with("search")
+ .short('i')
+ .action(ArgAction::SetTrue)
+ .help("view package information"),
+ )
+ .arg(
+ Arg::new("package")
+ .help("packages")
+ .required_unless_present("search")
+ .action(ArgAction::Set)
+ .num_args(1..),
+ ),
+ )
+ .get_matches();
+
+ match matches.subcommand() {
+ Some(("sync", sync_matches)) => {
+ if sync_matches.contains_id("search") {
+ let packages: Vec<_> = sync_matches
+ .get_many::<String>("search")
+ .expect("contains_id")
+ .map(|s| s.as_str())
+ .collect();
+ let values = packages.join(", ");
+ println!("Searching for {values}...");
+ return;
+ }
+
+ let packages: Vec<_> = sync_matches
+ .get_many::<String>("package")
+ .expect("is present")
+ .map(|s| s.as_str())
+ .collect();
+ let values = packages.join(", ");
+
+ if sync_matches.get_flag("info") {
+ println!("Retrieving info for {values}...");
+ } else {
+ println!("Installing {values}...");
+ }
+ }
+ Some(("query", query_matches)) => {
+ if let Some(packages) = query_matches.get_many::<String>("info") {
+ let comma_sep = packages.map(|s| s.as_str()).collect::<Vec<_>>().join(", ");
+ println!("Retrieving info for {comma_sep}...");
+ } else if let Some(queries) = query_matches.get_many::<String>("search") {
+ let comma_sep = queries.map(|s| s.as_str()).collect::<Vec<_>>().join(", ");
+ println!("Searching Locally for {comma_sep}...");
+ } else {
+ println!("Displaying all locally installed packages...");
+ }
+ }
+ _ => unreachable!(), // If all subcommands are defined above, anything else is unreachable
+ }
+}
diff --git a/third_party/rust/clap/examples/repl.rs b/third_party/rust/clap/examples/repl.rs
new file mode 100644
index 0000000000..d0baaed8d2
--- /dev/null
+++ b/third_party/rust/clap/examples/repl.rs
@@ -0,0 +1,92 @@
+use std::io::Write;
+
+use clap::Command;
+
+fn main() -> Result<(), String> {
+ loop {
+ let line = readline()?;
+ let line = line.trim();
+ if line.is_empty() {
+ continue;
+ }
+
+ match respond(line) {
+ Ok(quit) => {
+ if quit {
+ break;
+ }
+ }
+ Err(err) => {
+ write!(std::io::stdout(), "{err}").map_err(|e| e.to_string())?;
+ std::io::stdout().flush().map_err(|e| e.to_string())?;
+ }
+ }
+ }
+
+ Ok(())
+}
+
+fn respond(line: &str) -> Result<bool, String> {
+ let args = shlex::split(line).ok_or("error: Invalid quoting")?;
+ let matches = cli()
+ .try_get_matches_from(args)
+ .map_err(|e| e.to_string())?;
+ match matches.subcommand() {
+ Some(("ping", _matches)) => {
+ write!(std::io::stdout(), "Pong").map_err(|e| e.to_string())?;
+ std::io::stdout().flush().map_err(|e| e.to_string())?;
+ }
+ Some(("quit", _matches)) => {
+ write!(std::io::stdout(), "Exiting ...").map_err(|e| e.to_string())?;
+ std::io::stdout().flush().map_err(|e| e.to_string())?;
+ return Ok(true);
+ }
+ Some((name, _matches)) => unimplemented!("{name}"),
+ None => unreachable!("subcommand required"),
+ }
+
+ Ok(false)
+}
+
+fn cli() -> Command {
+ // strip out usage
+ const PARSER_TEMPLATE: &str = "\
+ {all-args}
+ ";
+ // strip out name/version
+ const APPLET_TEMPLATE: &str = "\
+ {about-with-newline}\n\
+ {usage-heading}\n {usage}\n\
+ \n\
+ {all-args}{after-help}\
+ ";
+
+ Command::new("repl")
+ .multicall(true)
+ .arg_required_else_help(true)
+ .subcommand_required(true)
+ .subcommand_value_name("APPLET")
+ .subcommand_help_heading("APPLETS")
+ .help_template(PARSER_TEMPLATE)
+ .subcommand(
+ Command::new("ping")
+ .about("Get a response")
+ .help_template(APPLET_TEMPLATE),
+ )
+ .subcommand(
+ Command::new("quit")
+ .alias("exit")
+ .about("Quit the REPL")
+ .help_template(APPLET_TEMPLATE),
+ )
+}
+
+fn readline() -> Result<String, String> {
+ write!(std::io::stdout(), "$ ").map_err(|e| e.to_string())?;
+ std::io::stdout().flush().map_err(|e| e.to_string())?;
+ let mut buffer = String::new();
+ std::io::stdin()
+ .read_line(&mut buffer)
+ .map_err(|e| e.to_string())?;
+ Ok(buffer)
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/01_quick.md b/third_party/rust/clap/examples/tutorial_builder/01_quick.md
new file mode 100644
index 0000000000..bdba15cd2c
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/01_quick.md
@@ -0,0 +1,35 @@
+```console
+$ 01_quick --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 01_quick[EXE] [OPTIONS] [name] [COMMAND]
+
+Commands:
+ test does testing things
+ help Print this message or the help of the given subcommand(s)
+
+Arguments:
+ [name] Optional name to operate on
+
+Options:
+ -c, --config <FILE> Sets a custom config file
+ -d, --debug... Turn debugging information on
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+By default, the program does nothing:
+```console
+$ 01_quick
+Debug mode is off
+
+```
+
+But you can mix and match the various features
+```console
+$ 01_quick -dd test
+Debug mode is on
+Not printing testing lists...
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/01_quick.rs b/third_party/rust/clap/examples/tutorial_builder/01_quick.rs
new file mode 100644
index 0000000000..328ce55199
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/01_quick.rs
@@ -0,0 +1,60 @@
+use std::path::PathBuf;
+
+use clap::{arg, command, value_parser, ArgAction, Command};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(arg!([name] "Optional name to operate on"))
+ .arg(
+ arg!(
+ -c --config <FILE> "Sets a custom config file"
+ )
+ // We don't have syntax yet for optional options, so manually calling `required`
+ .required(false)
+ .value_parser(value_parser!(PathBuf)),
+ )
+ .arg(arg!(
+ -d --debug ... "Turn debugging information on"
+ ))
+ .subcommand(
+ Command::new("test")
+ .about("does testing things")
+ .arg(arg!(-l --list "lists test values").action(ArgAction::SetTrue)),
+ )
+ .get_matches();
+
+ // You can check the value provided by positional arguments, or option arguments
+ if let Some(name) = matches.get_one::<String>("name") {
+ println!("Value for name: {name}");
+ }
+
+ if let Some(config_path) = matches.get_one::<PathBuf>("config") {
+ println!("Value for config: {}", config_path.display());
+ }
+
+ // You can see how many times a particular flag or argument occurred
+ // Note, only flags can have multiple occurrences
+ match matches
+ .get_one::<u8>("debug")
+ .expect("Count's are defaulted")
+ {
+ 0 => println!("Debug mode is off"),
+ 1 => println!("Debug mode is kind of on"),
+ 2 => println!("Debug mode is on"),
+ _ => println!("Don't be crazy"),
+ }
+
+ // You can check for the existence of subcommands, and if found use their
+ // matches just as you would the top level cmd
+ if let Some(matches) = matches.subcommand_matches("test") {
+ // "$ myapp test" was run
+ if matches.get_flag("list") {
+ // "$ myapp test -l" was run
+ println!("Printing testing lists...");
+ } else {
+ println!("Not printing testing lists...");
+ }
+ }
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_app_settings.md b/third_party/rust/clap/examples/tutorial_builder/02_app_settings.md
new file mode 100644
index 0000000000..3ac9a95e78
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_app_settings.md
@@ -0,0 +1,17 @@
+```console
+$ 02_app_settings --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 02_app_settings[EXE] --two <VALUE> --one <VALUE>
+
+Options:
+ --two <VALUE>
+
+ --one <VALUE>
+
+ -h, --help
+ Print help
+ -V, --version
+ Print version
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_app_settings.rs b/third_party/rust/clap/examples/tutorial_builder/02_app_settings.rs
new file mode 100644
index 0000000000..4e30ec9a52
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_app_settings.rs
@@ -0,0 +1,18 @@
+use clap::{arg, command, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .next_line_help(true)
+ .arg(arg!(--two <VALUE>).required(true).action(ArgAction::Set))
+ .arg(arg!(--one <VALUE>).required(true).action(ArgAction::Set))
+ .get_matches();
+
+ println!(
+ "two: {:?}",
+ matches.get_one::<String>("two").expect("required")
+ );
+ println!(
+ "one: {:?}",
+ matches.get_one::<String>("one").expect("required")
+ );
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_apps.md b/third_party/rust/clap/examples/tutorial_builder/02_apps.md
new file mode 100644
index 0000000000..1f8b071b19
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_apps.md
@@ -0,0 +1,16 @@
+```console
+$ 02_apps --help
+Does awesome things
+
+Usage: 02_apps[EXE] --two <VALUE> --one <VALUE>
+
+Options:
+ --two <VALUE>
+ --one <VALUE>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 02_apps --version
+MyApp 1.0
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_apps.rs b/third_party/rust/clap/examples/tutorial_builder/02_apps.rs
new file mode 100644
index 0000000000..7d98e6cfe4
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_apps.rs
@@ -0,0 +1,20 @@
+use clap::{arg, Command};
+
+fn main() {
+ let matches = Command::new("MyApp")
+ .version("1.0")
+ .author("Kevin K. <kbknapp@gmail.com>")
+ .about("Does awesome things")
+ .arg(arg!(--two <VALUE>).required(true))
+ .arg(arg!(--one <VALUE>).required(true))
+ .get_matches();
+
+ println!(
+ "two: {:?}",
+ matches.get_one::<String>("two").expect("required")
+ );
+ println!(
+ "one: {:?}",
+ matches.get_one::<String>("one").expect("required")
+ );
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_crate.md b/third_party/rust/clap/examples/tutorial_builder/02_crate.md
new file mode 100644
index 0000000000..a0d21b3ece
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_crate.md
@@ -0,0 +1,16 @@
+```console
+$ 02_crate --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 02_crate[EXE] --two <VALUE> --one <VALUE>
+
+Options:
+ --two <VALUE>
+ --one <VALUE>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 02_crate --version
+clap [..]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/02_crate.rs b/third_party/rust/clap/examples/tutorial_builder/02_crate.rs
new file mode 100644
index 0000000000..ad6bb4713b
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/02_crate.rs
@@ -0,0 +1,18 @@
+use clap::{arg, command};
+
+fn main() {
+ // requires `cargo` feature, reading name, version, author, and description from `Cargo.toml`
+ let matches = command!()
+ .arg(arg!(--two <VALUE>).required(true))
+ .arg(arg!(--one <VALUE>).required(true))
+ .get_matches();
+
+ println!(
+ "two: {:?}",
+ matches.get_one::<String>("two").expect("required")
+ );
+ println!(
+ "one: {:?}",
+ matches.get_one::<String>("one").expect("required")
+ );
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.md b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.md
new file mode 100644
index 0000000000..feec8e0a7a
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.md
@@ -0,0 +1,26 @@
+```console
+$ 03_01_flag_bool --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_01_flag_bool[EXE] [OPTIONS]
+
+Options:
+ -v, --verbose
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_01_flag_bool
+verbose: false
+
+$ 03_01_flag_bool --verbose
+verbose: true
+
+$ 03_01_flag_bool --verbose --verbose
+? failed
+error: the argument '--verbose' cannot be used multiple times
+
+Usage: 03_01_flag_bool[EXE] [OPTIONS]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.rs b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.rs
new file mode 100644
index 0000000000..03f2f1756f
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_bool.rs
@@ -0,0 +1,14 @@
+use clap::{command, Arg, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ Arg::new("verbose")
+ .short('v')
+ .long("verbose")
+ .action(ArgAction::SetTrue),
+ )
+ .get_matches();
+
+ println!("verbose: {:?}", matches.get_flag("verbose"));
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.md b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.md
new file mode 100644
index 0000000000..5e964b67a7
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.md
@@ -0,0 +1,21 @@
+```console
+$ 03_01_flag_count --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_01_flag_count[EXE] [OPTIONS]
+
+Options:
+ -v, --verbose...
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_01_flag_count
+verbose: 0
+
+$ 03_01_flag_count --verbose
+verbose: 1
+
+$ 03_01_flag_count --verbose --verbose
+verbose: 2
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.rs b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.rs
new file mode 100644
index 0000000000..492f7d4c1f
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_01_flag_count.rs
@@ -0,0 +1,14 @@
+use clap::{command, Arg, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ Arg::new("verbose")
+ .short('v')
+ .long("verbose")
+ .action(ArgAction::Count),
+ )
+ .get_matches();
+
+ println!("verbose: {:?}", matches.get_count("verbose"));
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_02_option.md b/third_party/rust/clap/examples/tutorial_builder/03_02_option.md
new file mode 100644
index 0000000000..42b81fd426
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_02_option.md
@@ -0,0 +1,30 @@
+```console
+$ 03_02_option --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_02_option[EXE] [OPTIONS]
+
+Options:
+ -n, --name <name>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_02_option
+name: None
+
+$ 03_02_option --name bob
+name: Some("bob")
+
+$ 03_02_option --name=bob
+name: Some("bob")
+
+$ 03_02_option -n bob
+name: Some("bob")
+
+$ 03_02_option -n=bob
+name: Some("bob")
+
+$ 03_02_option -nbob
+name: Some("bob")
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_02_option.rs b/third_party/rust/clap/examples/tutorial_builder/03_02_option.rs
new file mode 100644
index 0000000000..e9ba3e41a9
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_02_option.rs
@@ -0,0 +1,9 @@
+use clap::{command, Arg};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(Arg::new("name").short('n').long("name"))
+ .get_matches();
+
+ println!("name: {:?}", matches.get_one::<String>("name"));
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.md b/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.md
new file mode 100644
index 0000000000..659748e4de
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.md
@@ -0,0 +1,30 @@
+```console
+$ 03_02_option_mult --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_02_option_mult[EXE] [OPTIONS]
+
+Options:
+ -n, --name <name>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_02_option_mult
+name: None
+
+$ 03_02_option_mult --name bob
+name: Some("bob")
+
+$ 03_02_option_mult --name=bob
+name: Some("bob")
+
+$ 03_02_option_mult -n bob
+name: Some("bob")
+
+$ 03_02_option_mult -n=bob
+name: Some("bob")
+
+$ 03_02_option_mult -nbob
+name: Some("bob")
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.rs b/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.rs
new file mode 100644
index 0000000000..1370477eb4
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_02_option_mult.rs
@@ -0,0 +1,14 @@
+use clap::{command, Arg, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ Arg::new("name")
+ .short('n')
+ .long("name")
+ .action(ArgAction::Append),
+ )
+ .get_matches();
+
+ println!("name: {:?}", matches.get_one::<String>("name"));
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_03_positional.md b/third_party/rust/clap/examples/tutorial_builder/03_03_positional.md
new file mode 100644
index 0000000000..d8d49f39b6
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_03_positional.md
@@ -0,0 +1,20 @@
+```console
+$ 03_03_positional --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_03_positional[EXE] [name]
+
+Arguments:
+ [name]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_03_positional
+name: None
+
+$ 03_03_positional bob
+name: Some("bob")
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_03_positional.rs b/third_party/rust/clap/examples/tutorial_builder/03_03_positional.rs
new file mode 100644
index 0000000000..f652d27ca5
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_03_positional.rs
@@ -0,0 +1,9 @@
+use clap::{command, Arg};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(Arg::new("name"))
+ .get_matches();
+
+ println!("name: {:?}", matches.get_one::<String>("name"));
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.md b/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.md
new file mode 100644
index 0000000000..174ddd9f7b
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.md
@@ -0,0 +1,23 @@
+```console
+$ 03_03_positional_mult --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_03_positional_mult[EXE] [name]...
+
+Arguments:
+ [name]...
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_03_positional_mult
+names: []
+
+$ 03_03_positional_mult bob
+names: ["bob"]
+
+$ 03_03_positional_mult bob john
+names: ["bob", "john"]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.rs b/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.rs
new file mode 100644
index 0000000000..bcd288d8dc
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_03_positional_mult.rs
@@ -0,0 +1,15 @@
+use clap::{command, Arg, ArgAction};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(Arg::new("name").action(ArgAction::Append))
+ .get_matches();
+
+ let args = matches
+ .get_many::<String>("name")
+ .unwrap_or_default()
+ .map(|v| v.as_str())
+ .collect::<Vec<_>>();
+
+ println!("names: {:?}", &args);
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.md b/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.md
new file mode 100644
index 0000000000..a32b776855
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.md
@@ -0,0 +1,59 @@
+```console
+$ 03_04_subcommands help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_04_subcommands[EXE] <COMMAND>
+
+Commands:
+ add Adds files to myapp
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_04_subcommands help add
+Adds files to myapp
+
+Usage: 03_04_subcommands[EXE] add [NAME]
+
+Arguments:
+ [NAME]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_04_subcommands add bob
+'myapp add' was used, name is: Some("bob")
+
+```
+
+Because we set [`Command::arg_required_else_help`][crate::Command::arg_required_else_help]:
+```console
+$ 03_04_subcommands
+? failed
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_04_subcommands[EXE] <COMMAND>
+
+Commands:
+ add Adds files to myapp
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Since we specified [`Command::propagate_version`][crate::Command::propagate_version], the `--version` flag
+is available in all subcommands:
+```console
+$ 03_04_subcommands --version
+clap [..]
+
+$ 03_04_subcommands add --version
+clap-add [..]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.rs b/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.rs
new file mode 100644
index 0000000000..fbe23809e9
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_04_subcommands.rs
@@ -0,0 +1,22 @@
+use clap::{arg, command, Command};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .propagate_version(true)
+ .subcommand_required(true)
+ .arg_required_else_help(true)
+ .subcommand(
+ Command::new("add")
+ .about("Adds files to myapp")
+ .arg(arg!([NAME])),
+ )
+ .get_matches();
+
+ match matches.subcommand() {
+ Some(("add", sub_matches)) => println!(
+ "'myapp add' was used, name is: {:?}",
+ sub_matches.get_one::<String>("NAME")
+ ),
+ _ => unreachable!("Exhausted list of subcommands and subcommand_required prevents `None`"),
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.md b/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.md
new file mode 100644
index 0000000000..b62a415508
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.md
@@ -0,0 +1,20 @@
+```console
+$ 03_05_default_values --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_05_default_values[EXE] [PORT]
+
+Arguments:
+ [PORT] [default: 2020]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_05_default_values
+port: 2020
+
+$ 03_05_default_values 22
+port: 22
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.rs b/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.rs
new file mode 100644
index 0000000000..d259ee06ed
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/03_05_default_values.rs
@@ -0,0 +1,18 @@
+use clap::{arg, command, value_parser};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ arg!([PORT])
+ .value_parser(value_parser!(u16))
+ .default_value("2020"),
+ )
+ .get_matches();
+
+ println!(
+ "port: {:?}",
+ matches
+ .get_one::<u16>("PORT")
+ .expect("default ensures there is always a value")
+ );
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_01_enum.md b/third_party/rust/clap/examples/tutorial_builder/04_01_enum.md
new file mode 100644
index 0000000000..ec4c0aea1d
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_01_enum.md
@@ -0,0 +1,47 @@
+```console
+$ 04_01_enum --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_01_enum[EXE] <MODE>
+
+Arguments:
+ <MODE>
+ What mode to run the program in
+
+ Possible values:
+ - fast: Run swiftly
+ - slow: Crawl slowly but steadily
+
+Options:
+ -h, --help
+ Print help (see a summary with '-h')
+
+ -V, --version
+ Print version
+
+$ 04_01_enum -h
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_01_enum[EXE] <MODE>
+
+Arguments:
+ <MODE> What mode to run the program in [possible values: fast, slow]
+
+Options:
+ -h, --help Print help (see more with '--help')
+ -V, --version Print version
+
+$ 04_01_enum fast
+Hare
+
+$ 04_01_enum slow
+Tortoise
+
+$ 04_01_enum medium
+? failed
+error: invalid value 'medium' for '<MODE>'
+ [possible values: fast, slow]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_01_enum.rs b/third_party/rust/clap/examples/tutorial_builder/04_01_enum.rs
new file mode 100644
index 0000000000..aa9f41ce6d
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_01_enum.rs
@@ -0,0 +1,66 @@
+use clap::{arg, builder::PossibleValue, command, value_parser, ValueEnum};
+
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
+enum Mode {
+ Fast,
+ Slow,
+}
+
+// Can also be derived with feature flag `derive`
+impl ValueEnum for Mode {
+ fn value_variants<'a>() -> &'a [Self] {
+ &[Mode::Fast, Mode::Slow]
+ }
+
+ fn to_possible_value<'a>(&self) -> Option<PossibleValue> {
+ Some(match self {
+ Mode::Fast => PossibleValue::new("fast").help("Run swiftly"),
+ Mode::Slow => PossibleValue::new("slow").help("Crawl slowly but steadily"),
+ })
+ }
+}
+
+impl std::fmt::Display for Mode {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ self.to_possible_value()
+ .expect("no values are skipped")
+ .get_name()
+ .fmt(f)
+ }
+}
+
+impl std::str::FromStr for Mode {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ for variant in Self::value_variants() {
+ if variant.to_possible_value().unwrap().matches(s, false) {
+ return Ok(*variant);
+ }
+ }
+ Err(format!("invalid variant: {s}"))
+ }
+}
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ arg!(<MODE>)
+ .help("What mode to run the program in")
+ .value_parser(value_parser!(Mode)),
+ )
+ .get_matches();
+
+ // Note, it's safe to call unwrap() because the arg is required
+ match matches
+ .get_one::<Mode>("MODE")
+ .expect("'MODE' is required and parsing will fail if its missing")
+ {
+ Mode::Fast => {
+ println!("Hare");
+ }
+ Mode::Slow => {
+ println!("Tortoise");
+ }
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_01_possible.md b/third_party/rust/clap/examples/tutorial_builder/04_01_possible.md
new file mode 100644
index 0000000000..fa2c835390
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_01_possible.md
@@ -0,0 +1,27 @@
+```console
+$ 04_01_possible --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_01_possible[EXE] <MODE>
+
+Arguments:
+ <MODE> What mode to run the program in [possible values: fast, slow]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_01_possible fast
+Hare
+
+$ 04_01_possible slow
+Tortoise
+
+$ 04_01_possible medium
+? failed
+error: invalid value 'medium' for '<MODE>'
+ [possible values: fast, slow]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_01_possible.rs b/third_party/rust/clap/examples/tutorial_builder/04_01_possible.rs
new file mode 100644
index 0000000000..3da7aca74b
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_01_possible.rs
@@ -0,0 +1,26 @@
+use clap::{arg, command};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ arg!(<MODE>)
+ .help("What mode to run the program in")
+ .value_parser(["fast", "slow"]),
+ )
+ .get_matches();
+
+ // Note, it's safe to call unwrap() because the arg is required
+ match matches
+ .get_one::<String>("MODE")
+ .expect("'MODE' is required and parsing will fail if its missing")
+ .as_str()
+ {
+ "fast" => {
+ println!("Hare");
+ }
+ "slow" => {
+ println!("Tortoise");
+ }
+ _ => unreachable!(),
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_02_parse.md b/third_party/rust/clap/examples/tutorial_builder/04_02_parse.md
new file mode 100644
index 0000000000..af03e95cbc
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_02_parse.md
@@ -0,0 +1,29 @@
+```console
+$ 04_02_parse --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_02_parse[EXE] <PORT>
+
+Arguments:
+ <PORT> Network port to use
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_02_parse 22
+PORT = 22
+
+$ 04_02_parse foobar
+? failed
+error: invalid value 'foobar' for '<PORT>': invalid digit found in string
+
+For more information, try '--help'.
+
+$ 04_02_parse_derive 0
+? failed
+error: invalid value '0' for '<PORT>': 0 is not in 1..=65535
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_02_parse.rs b/third_party/rust/clap/examples/tutorial_builder/04_02_parse.rs
new file mode 100644
index 0000000000..a3f79040d7
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_02_parse.rs
@@ -0,0 +1,17 @@
+use clap::{arg, command, value_parser};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ arg!(<PORT>)
+ .help("Network port to use")
+ .value_parser(value_parser!(u16).range(1..)),
+ )
+ .get_matches();
+
+ // Note, it's safe to call unwrap() because the arg is required
+ let port: u16 = *matches
+ .get_one::<u16>("PORT")
+ .expect("'PORT' is required and parsing will fail if its missing");
+ println!("PORT = {port}");
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_02_validate.md b/third_party/rust/clap/examples/tutorial_builder/04_02_validate.md
new file mode 100644
index 0000000000..949072bee5
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_02_validate.md
@@ -0,0 +1,29 @@
+```console
+$ 04_02_validate --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_02_validate[EXE] <PORT>
+
+Arguments:
+ <PORT> Network port to use
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_02_validate 22
+PORT = 22
+
+$ 04_02_validate foobar
+? failed
+error: invalid value 'foobar' for '<PORT>': `foobar` isn't a port number
+
+For more information, try '--help'.
+
+$ 04_02_validate 0
+? failed
+error: invalid value '0' for '<PORT>': port not in range 1-65535
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_02_validate.rs b/third_party/rust/clap/examples/tutorial_builder/04_02_validate.rs
new file mode 100644
index 0000000000..0ce53d6544
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_02_validate.rs
@@ -0,0 +1,36 @@
+use std::ops::RangeInclusive;
+
+use clap::{arg, command};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(
+ arg!(<PORT>)
+ .help("Network port to use")
+ .value_parser(port_in_range),
+ )
+ .get_matches();
+
+ // Note, it's safe to call unwrap() because the arg is required
+ let port: u16 = *matches
+ .get_one::<u16>("PORT")
+ .expect("'PORT' is required and parsing will fail if its missing");
+ println!("PORT = {port}");
+}
+
+const PORT_RANGE: RangeInclusive<usize> = 1..=65535;
+
+fn port_in_range(s: &str) -> Result<u16, String> {
+ let port: usize = s
+ .parse()
+ .map_err(|_| format!("`{s}` isn't a port number"))?;
+ if PORT_RANGE.contains(&port) {
+ Ok(port as u16)
+ } else {
+ Err(format!(
+ "port not in range {}-{}",
+ PORT_RANGE.start(),
+ PORT_RANGE.end()
+ ))
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_03_relations.md b/third_party/rust/clap/examples/tutorial_builder/04_03_relations.md
new file mode 100644
index 0000000000..dd0c35a683
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_03_relations.md
@@ -0,0 +1,53 @@
+```console
+$ 04_03_relations --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_03_relations[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+Arguments:
+ [INPUT_FILE] some regular input
+
+Options:
+ --set-ver <VER> set version manually
+ --major auto inc major
+ --minor auto inc minor
+ --patch auto inc patch
+ --spec-in <SPEC_IN> some special input argument
+ -c <CONFIG>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_03_relations
+? failed
+error: the following required arguments were not provided:
+ <--set-ver <VER>|--major|--minor|--patch>
+
+Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_03_relations --major
+Version: 2.2.3
+
+$ 04_03_relations --major --minor
+? failed
+error: the argument '--major' cannot be used with '--minor'
+
+Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_03_relations --major -c config.toml
+? failed
+error: the following required arguments were not provided:
+ <INPUT_FILE|--spec-in <SPEC_IN>>
+
+Usage: 04_03_relations[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
+
+For more information, try '--help'.
+
+$ 04_03_relations --major -c config.toml --spec-in input.txt
+Version: 2.2.3
+Doing work using input input.txt and config config.toml
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_03_relations.rs b/third_party/rust/clap/examples/tutorial_builder/04_03_relations.rs
new file mode 100644
index 0000000000..935e7a334c
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_03_relations.rs
@@ -0,0 +1,78 @@
+use std::path::PathBuf;
+
+use clap::{arg, command, value_parser, ArgAction, ArgGroup};
+
+fn main() {
+ // Create application like normal
+ let matches = command!() // requires `cargo` feature
+ // Add the version arguments
+ .arg(arg!(--"set-ver" <VER> "set version manually"))
+ .arg(arg!(--major "auto inc major").action(ArgAction::SetTrue))
+ .arg(arg!(--minor "auto inc minor").action(ArgAction::SetTrue))
+ .arg(arg!(--patch "auto inc patch").action(ArgAction::SetTrue))
+ // Create a group, make it required, and add the above arguments
+ .group(
+ ArgGroup::new("vers")
+ .required(true)
+ .args(["set-ver", "major", "minor", "patch"]),
+ )
+ // Arguments can also be added to a group individually, these two arguments
+ // are part of the "input" group which is not required
+ .arg(
+ arg!([INPUT_FILE] "some regular input")
+ .value_parser(value_parser!(PathBuf))
+ .group("input"),
+ )
+ .arg(
+ arg!(--"spec-in" <SPEC_IN> "some special input argument")
+ .value_parser(value_parser!(PathBuf))
+ .group("input"),
+ )
+ // Now let's assume we have a -c [config] argument which requires one of
+ // (but **not** both) the "input" arguments
+ .arg(
+ arg!(config: -c <CONFIG>)
+ .value_parser(value_parser!(PathBuf))
+ .requires("input"),
+ )
+ .get_matches();
+
+ // Let's assume the old version 1.2.3
+ let mut major = 1;
+ let mut minor = 2;
+ let mut patch = 3;
+
+ // See if --set-ver was used to set the version manually
+ let version = if let Some(ver) = matches.get_one::<String>("set-ver") {
+ ver.to_owned()
+ } else {
+ // Increment the one requested (in a real program, we'd reset the lower numbers)
+ let (maj, min, pat) = (
+ matches.get_flag("major"),
+ matches.get_flag("minor"),
+ matches.get_flag("patch"),
+ );
+ match (maj, min, pat) {
+ (true, _, _) => major += 1,
+ (_, true, _) => minor += 1,
+ (_, _, true) => patch += 1,
+ _ => unreachable!(),
+ };
+ format!("{major}.{minor}.{patch}")
+ };
+
+ println!("Version: {version}");
+
+ // Check for usage of -c
+ if matches.contains_id("config") {
+ let input = matches
+ .get_one::<PathBuf>("INPUT_FILE")
+ .unwrap_or_else(|| matches.get_one::<PathBuf>("spec-in").unwrap())
+ .display();
+ println!(
+ "Doing work using input {} and config {}",
+ input,
+ matches.get_one::<PathBuf>("config").unwrap().display()
+ );
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_04_custom.md b/third_party/rust/clap/examples/tutorial_builder/04_04_custom.md
new file mode 100644
index 0000000000..0a83eb9b8e
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_04_custom.md
@@ -0,0 +1,52 @@
+```console
+$ 04_04_custom --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
+
+Arguments:
+ [INPUT_FILE] some regular input
+
+Options:
+ --set-ver <VER> set version manually
+ --major auto inc major
+ --minor auto inc minor
+ --patch auto inc patch
+ --spec-in <SPEC_IN> some special input argument
+ -c <CONFIG>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_04_custom
+? failed
+error: Can only modify one version field
+
+Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom --major
+Version: 2.2.3
+
+$ 04_04_custom --major --minor
+? failed
+error: Can only modify one version field
+
+Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom --major -c config.toml
+? failed
+Version: 2.2.3
+error: INPUT_FILE or --spec-in is required when using --config
+
+Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom --major -c config.toml --spec-in input.txt
+Version: 2.2.3
+Doing work using input input.txt and config config.toml
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_builder/04_04_custom.rs b/third_party/rust/clap/examples/tutorial_builder/04_04_custom.rs
new file mode 100644
index 0000000000..840b3aa4f7
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/04_04_custom.rs
@@ -0,0 +1,84 @@
+use std::path::PathBuf;
+
+use clap::error::ErrorKind;
+use clap::{arg, command, value_parser, ArgAction};
+
+fn main() {
+ // Create application like normal
+ let mut cmd = command!() // requires `cargo` feature
+ // Add the version arguments
+ .arg(arg!(--"set-ver" <VER> "set version manually"))
+ .arg(arg!(--major "auto inc major").action(ArgAction::SetTrue))
+ .arg(arg!(--minor "auto inc minor").action(ArgAction::SetTrue))
+ .arg(arg!(--patch "auto inc patch").action(ArgAction::SetTrue))
+ // Arguments can also be added to a group individually, these two arguments
+ // are part of the "input" group which is not required
+ .arg(arg!([INPUT_FILE] "some regular input").value_parser(value_parser!(PathBuf)))
+ .arg(
+ arg!(--"spec-in" <SPEC_IN> "some special input argument")
+ .value_parser(value_parser!(PathBuf)),
+ )
+ // Now let's assume we have a -c [config] argument which requires one of
+ // (but **not** both) the "input" arguments
+ .arg(arg!(config: -c <CONFIG>).value_parser(value_parser!(PathBuf)));
+ let matches = cmd.get_matches_mut();
+
+ // Let's assume the old version 1.2.3
+ let mut major = 1;
+ let mut minor = 2;
+ let mut patch = 3;
+
+ // See if --set-ver was used to set the version manually
+ let version = if let Some(ver) = matches.get_one::<String>("set-ver") {
+ if matches.get_flag("major") || matches.get_flag("minor") || matches.get_flag("patch") {
+ cmd.error(
+ ErrorKind::ArgumentConflict,
+ "Can't do relative and absolute version change",
+ )
+ .exit();
+ }
+ ver.to_string()
+ } else {
+ // Increment the one requested (in a real program, we'd reset the lower numbers)
+ let (maj, min, pat) = (
+ matches.get_flag("major"),
+ matches.get_flag("minor"),
+ matches.get_flag("patch"),
+ );
+ match (maj, min, pat) {
+ (true, false, false) => major += 1,
+ (false, true, false) => minor += 1,
+ (false, false, true) => patch += 1,
+ _ => {
+ cmd.error(
+ ErrorKind::ArgumentConflict,
+ "Can only modify one version field",
+ )
+ .exit();
+ }
+ };
+ format!("{major}.{minor}.{patch}")
+ };
+
+ println!("Version: {version}");
+
+ // Check for usage of -c
+ if matches.contains_id("config") {
+ let input = matches
+ .get_one::<PathBuf>("INPUT_FILE")
+ .or_else(|| matches.get_one::<PathBuf>("spec-in"))
+ .unwrap_or_else(|| {
+ cmd.error(
+ ErrorKind::MissingRequiredArgument,
+ "INPUT_FILE or --spec-in is required when using --config",
+ )
+ .exit()
+ })
+ .display();
+ println!(
+ "Doing work using input {} and config {}",
+ input,
+ matches.get_one::<PathBuf>("config").unwrap().display()
+ );
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_builder/05_01_assert.rs b/third_party/rust/clap/examples/tutorial_builder/05_01_assert.rs
new file mode 100644
index 0000000000..b42c5762e7
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_builder/05_01_assert.rs
@@ -0,0 +1,25 @@
+use clap::{arg, command, value_parser};
+
+fn main() {
+ let matches = cmd().get_matches();
+
+ // Note, it's safe to call unwrap() because the arg is required
+ let port: usize = *matches
+ .get_one::<usize>("PORT")
+ .expect("'PORT' is required and parsing will fail if its missing");
+ println!("PORT = {port}");
+}
+
+fn cmd() -> clap::Command {
+ command!() // requires `cargo` feature
+ .arg(
+ arg!(<PORT>)
+ .help("Network port to use")
+ .value_parser(value_parser!(usize)),
+ )
+}
+
+#[test]
+fn verify_cmd() {
+ cmd().debug_assert();
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/01_quick.md b/third_party/rust/clap/examples/tutorial_derive/01_quick.md
new file mode 100644
index 0000000000..21bbfe1a65
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/01_quick.md
@@ -0,0 +1,35 @@
+```console
+$ 01_quick_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 01_quick_derive[EXE] [OPTIONS] [NAME] [COMMAND]
+
+Commands:
+ test does testing things
+ help Print this message or the help of the given subcommand(s)
+
+Arguments:
+ [NAME] Optional name to operate on
+
+Options:
+ -c, --config <FILE> Sets a custom config file
+ -d, --debug... Turn debugging information on
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+By default, the program does nothing:
+```console
+$ 01_quick_derive
+Debug mode is off
+
+```
+
+But you can mix and match the various features
+```console
+$ 01_quick_derive -dd test
+Debug mode is on
+Not printing testing lists...
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/01_quick.rs b/third_party/rust/clap/examples/tutorial_derive/01_quick.rs
new file mode 100644
index 0000000000..0edcd251f9
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/01_quick.rs
@@ -0,0 +1,68 @@
+use std::path::PathBuf;
+
+use clap::{Parser, Subcommand};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// Optional name to operate on
+ name: Option<String>,
+
+ /// Sets a custom config file
+ #[arg(short, long, value_name = "FILE")]
+ config: Option<PathBuf>,
+
+ /// Turn debugging information on
+ #[arg(short, long, action = clap::ArgAction::Count)]
+ debug: u8,
+
+ #[command(subcommand)]
+ command: Option<Commands>,
+}
+
+#[derive(Subcommand)]
+enum Commands {
+ /// does testing things
+ Test {
+ /// lists test values
+ #[arg(short, long)]
+ list: bool,
+ },
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ // You can check the value provided by positional arguments, or option arguments
+ if let Some(name) = cli.name.as_deref() {
+ println!("Value for name: {name}");
+ }
+
+ if let Some(config_path) = cli.config.as_deref() {
+ println!("Value for config: {}", config_path.display());
+ }
+
+ // You can see how many times a particular flag or argument occurred
+ // Note, only flags can have multiple occurrences
+ match cli.debug {
+ 0 => println!("Debug mode is off"),
+ 1 => println!("Debug mode is kind of on"),
+ 2 => println!("Debug mode is on"),
+ _ => println!("Don't be crazy"),
+ }
+
+ // You can check for the existence of subcommands, and if found use their
+ // matches just as you would the top level cmd
+ match &cli.command {
+ Some(Commands::Test { list }) => {
+ if *list {
+ println!("Printing testing lists...");
+ } else {
+ println!("Not printing testing lists...");
+ }
+ }
+ None => {}
+ }
+
+ // Continued program logic goes here...
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_app_settings.md b/third_party/rust/clap/examples/tutorial_derive/02_app_settings.md
new file mode 100644
index 0000000000..90da3ae19b
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_app_settings.md
@@ -0,0 +1,17 @@
+```console
+$ 02_app_settings_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 02_app_settings_derive[EXE] --two <TWO> --one <ONE>
+
+Options:
+ --two <TWO>
+
+ --one <ONE>
+
+ -h, --help
+ Print help
+ -V, --version
+ Print version
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_app_settings.rs b/third_party/rust/clap/examples/tutorial_derive/02_app_settings.rs
new file mode 100644
index 0000000000..abea13d19f
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_app_settings.rs
@@ -0,0 +1,18 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+#[command(next_line_help = true)]
+struct Cli {
+ #[arg(long)]
+ two: String,
+ #[arg(long)]
+ one: String,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("two: {:?}", cli.two);
+ println!("one: {:?}", cli.one);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_apps.md b/third_party/rust/clap/examples/tutorial_derive/02_apps.md
new file mode 100644
index 0000000000..b5ae1147fd
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_apps.md
@@ -0,0 +1,16 @@
+```console
+$ 02_apps_derive --help
+Does awesome things
+
+Usage: 02_apps_derive[EXE] --two <TWO> --one <ONE>
+
+Options:
+ --two <TWO>
+ --one <ONE>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 02_apps_derive --version
+MyApp 1.0
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_apps.rs b/third_party/rust/clap/examples/tutorial_derive/02_apps.rs
new file mode 100644
index 0000000000..75455efcee
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_apps.rs
@@ -0,0 +1,20 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(name = "MyApp")]
+#[command(author = "Kevin K. <kbknapp@gmail.com>")]
+#[command(version = "1.0")]
+#[command(about = "Does awesome things", long_about = None)]
+struct Cli {
+ #[arg(long)]
+ two: String,
+ #[arg(long)]
+ one: String,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("two: {:?}", cli.two);
+ println!("one: {:?}", cli.one);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_crate.md b/third_party/rust/clap/examples/tutorial_derive/02_crate.md
new file mode 100644
index 0000000000..3f64460640
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_crate.md
@@ -0,0 +1,16 @@
+```console
+$ 02_crate_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 02_crate_derive[EXE] --two <TWO> --one <ONE>
+
+Options:
+ --two <TWO>
+ --one <ONE>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 02_crate_derive --version
+clap [..]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/02_crate.rs b/third_party/rust/clap/examples/tutorial_derive/02_crate.rs
new file mode 100644
index 0000000000..33a7a4ee0f
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/02_crate.rs
@@ -0,0 +1,17 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)] // Read from `Cargo.toml`
+struct Cli {
+ #[arg(long)]
+ two: String,
+ #[arg(long)]
+ one: String,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("two: {:?}", cli.two);
+ println!("one: {:?}", cli.one);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.md b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.md
new file mode 100644
index 0000000000..976226003b
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.md
@@ -0,0 +1,26 @@
+```console
+$ 03_01_flag_bool_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_01_flag_bool_derive[EXE] [OPTIONS]
+
+Options:
+ -v, --verbose
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_01_flag_bool_derive
+verbose: false
+
+$ 03_01_flag_bool_derive --verbose
+verbose: true
+
+$ 03_01_flag_bool_derive --verbose --verbose
+? failed
+error: the argument '--verbose' cannot be used multiple times
+
+Usage: 03_01_flag_bool_derive[EXE] [OPTIONS]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.rs b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.rs
new file mode 100644
index 0000000000..4f68fc834a
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_bool.rs
@@ -0,0 +1,14 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(short, long)]
+ verbose: bool,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("verbose: {:?}", cli.verbose);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.md b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.md
new file mode 100644
index 0000000000..56ef9cafd9
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.md
@@ -0,0 +1,21 @@
+```console
+$ 03_01_flag_count_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_01_flag_count_derive[EXE] [OPTIONS]
+
+Options:
+ -v, --verbose...
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_01_flag_count_derive
+verbose: 0
+
+$ 03_01_flag_count_derive --verbose
+verbose: 1
+
+$ 03_01_flag_count_derive --verbose --verbose
+verbose: 2
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.rs b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.rs
new file mode 100644
index 0000000000..2b8a453ed2
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_01_flag_count.rs
@@ -0,0 +1,14 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(short, long, action = clap::ArgAction::Count)]
+ verbose: u8,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("verbose: {:?}", cli.verbose);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_02_option.md b/third_party/rust/clap/examples/tutorial_derive/03_02_option.md
new file mode 100644
index 0000000000..24e272aa81
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_02_option.md
@@ -0,0 +1,30 @@
+```console
+$ 03_02_option_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_02_option_derive[EXE] [OPTIONS]
+
+Options:
+ -n, --name <NAME>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_02_option_derive
+name: None
+
+$ 03_02_option_derive --name bob
+name: Some("bob")
+
+$ 03_02_option_derive --name=bob
+name: Some("bob")
+
+$ 03_02_option_derive -n bob
+name: Some("bob")
+
+$ 03_02_option_derive -n=bob
+name: Some("bob")
+
+$ 03_02_option_derive -nbob
+name: Some("bob")
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_02_option.rs b/third_party/rust/clap/examples/tutorial_derive/03_02_option.rs
new file mode 100644
index 0000000000..aad8ef10b2
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_02_option.rs
@@ -0,0 +1,14 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(short, long)]
+ name: Option<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("name: {:?}", cli.name.as_deref());
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.md b/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.md
new file mode 100644
index 0000000000..cd2fe1301f
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.md
@@ -0,0 +1,30 @@
+```console
+$ 03_02_option_mult_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_02_option_mult_derive[EXE] [OPTIONS]
+
+Options:
+ -n, --name <NAME>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_02_option_mult_derive
+name: []
+
+$ 03_02_option_mult_derive --name bob
+name: ["bob"]
+
+$ 03_02_option_mult_derive --name=bob
+name: ["bob"]
+
+$ 03_02_option_mult_derive -n bob
+name: ["bob"]
+
+$ 03_02_option_mult_derive -n=bob
+name: ["bob"]
+
+$ 03_02_option_mult_derive -nbob
+name: ["bob"]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.rs b/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.rs
new file mode 100644
index 0000000000..1caa440aaa
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_02_option_mult.rs
@@ -0,0 +1,14 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(short, long)]
+ name: Vec<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("name: {:?}", cli.name);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_03_positional.md b/third_party/rust/clap/examples/tutorial_derive/03_03_positional.md
new file mode 100644
index 0000000000..9437c246f2
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_03_positional.md
@@ -0,0 +1,20 @@
+```console
+$ 03_03_positional_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_03_positional_derive[EXE] [NAME]
+
+Arguments:
+ [NAME]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_03_positional_derive
+name: None
+
+$ 03_03_positional_derive bob
+name: Some("bob")
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_03_positional.rs b/third_party/rust/clap/examples/tutorial_derive/03_03_positional.rs
new file mode 100644
index 0000000000..cf5f4054fb
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_03_positional.rs
@@ -0,0 +1,13 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ name: Option<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("name: {:?}", cli.name.as_deref());
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.md b/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.md
new file mode 100644
index 0000000000..8f295e02ba
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.md
@@ -0,0 +1,23 @@
+```console
+$ 03_03_positional_mult_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_03_positional_mult_derive[EXE] [NAME]...
+
+Arguments:
+ [NAME]...
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_03_positional_mult_derive
+name: []
+
+$ 03_03_positional_mult_derive bob
+name: ["bob"]
+
+$ 03_03_positional_mult_derive bob john
+name: ["bob", "john"]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.rs b/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.rs
new file mode 100644
index 0000000000..bd57a55c81
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_03_positional_mult.rs
@@ -0,0 +1,13 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ name: Vec<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("name: {:?}", cli.name);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.md b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.md
new file mode 100644
index 0000000000..4d57dfeeeb
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.md
@@ -0,0 +1,60 @@
+```console
+$ 03_04_subcommands_derive help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_04_subcommands_derive[EXE] <COMMAND>
+
+Commands:
+ add Adds files to myapp
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_04_subcommands_derive help add
+Adds files to myapp
+
+Usage: 03_04_subcommands_derive[EXE] add [NAME]
+
+Arguments:
+ [NAME]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_04_subcommands_derive add bob
+'myapp add' was used, name is: Some("bob")
+
+```
+
+When specifying commands with `command: Commands`, they are required.
+Alternatively, you could do `command: Option<Commands>` to make it optional.
+```console
+$ 03_04_subcommands_derive
+? failed
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_04_subcommands_derive[EXE] <COMMAND>
+
+Commands:
+ add Adds files to myapp
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+```
+
+Since we specified [`#[command(propagate_version = true)]`][crate::Command::propagate_version],
+the `--version` flag is available in all subcommands:
+```console
+$ 03_04_subcommands_derive --version
+clap [..]
+
+$ 03_04_subcommands_derive add --version
+clap-add [..]
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.rs b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.rs
new file mode 100644
index 0000000000..da7c644c70
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands.rs
@@ -0,0 +1,27 @@
+use clap::{Parser, Subcommand};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+#[command(propagate_version = true)]
+struct Cli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Subcommand)]
+enum Commands {
+ /// Adds files to myapp
+ Add { name: Option<String> },
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ // You can check for the existence of subcommands, and if found use their
+ // matches just as you would the top level cmd
+ match &cli.command {
+ Commands::Add { name } => {
+ println!("'myapp add' was used, name is: {name:?}")
+ }
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands_alt.rs b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands_alt.rs
new file mode 100644
index 0000000000..80b0ec6b95
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_04_subcommands_alt.rs
@@ -0,0 +1,32 @@
+use clap::{Args, Parser, Subcommand};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+#[command(propagate_version = true)]
+struct Cli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Subcommand)]
+enum Commands {
+ /// Adds files to myapp
+ Add(AddArgs),
+}
+
+#[derive(Args)]
+struct AddArgs {
+ name: Option<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ // You can check for the existence of subcommands, and if found use their
+ // matches just as you would the top level cmd
+ match &cli.command {
+ Commands::Add(name) => {
+ println!("'myapp add' was used, name is: {:?}", name.name)
+ }
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.md b/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.md
new file mode 100644
index 0000000000..994cb33282
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.md
@@ -0,0 +1,20 @@
+```console
+$ 03_05_default_values_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 03_05_default_values_derive[EXE] [PORT]
+
+Arguments:
+ [PORT] [default: 2020]
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 03_05_default_values_derive
+port: 2020
+
+$ 03_05_default_values_derive 22
+port: 22
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.rs b/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.rs
new file mode 100644
index 0000000000..bc33a931ab
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/03_05_default_values.rs
@@ -0,0 +1,14 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[arg(default_value_t = 2020)]
+ port: u16,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("port: {:?}", cli.port);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_01_enum.md b/third_party/rust/clap/examples/tutorial_derive/04_01_enum.md
new file mode 100644
index 0000000000..89db08c96e
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_01_enum.md
@@ -0,0 +1,47 @@
+```console
+$ 04_01_enum_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_01_enum_derive[EXE] <MODE>
+
+Arguments:
+ <MODE>
+ What mode to run the program in
+
+ Possible values:
+ - fast: Run swiftly
+ - slow: Crawl slowly but steadily
+
+Options:
+ -h, --help
+ Print help (see a summary with '-h')
+
+ -V, --version
+ Print version
+
+$ 04_01_enum_derive -h
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_01_enum_derive[EXE] <MODE>
+
+Arguments:
+ <MODE> What mode to run the program in [possible values: fast, slow]
+
+Options:
+ -h, --help Print help (see more with '--help')
+ -V, --version Print version
+
+$ 04_01_enum_derive fast
+Hare
+
+$ 04_01_enum_derive slow
+Tortoise
+
+$ 04_01_enum_derive medium
+? failed
+error: invalid value 'medium' for '<MODE>'
+ [possible values: fast, slow]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_01_enum.rs b/third_party/rust/clap/examples/tutorial_derive/04_01_enum.rs
new file mode 100644
index 0000000000..41410a3bdc
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_01_enum.rs
@@ -0,0 +1,32 @@
+use clap::{Parser, ValueEnum};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// What mode to run the program in
+ #[arg(value_enum)]
+ mode: Mode,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
+enum Mode {
+ /// Run swiftly
+ Fast,
+ /// Crawl slowly but steadily
+ ///
+ /// This paragraph is ignored because there is no long help text for possible values.
+ Slow,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ match cli.mode {
+ Mode::Fast => {
+ println!("Hare");
+ }
+ Mode::Slow => {
+ println!("Tortoise");
+ }
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_02_parse.md b/third_party/rust/clap/examples/tutorial_derive/04_02_parse.md
new file mode 100644
index 0000000000..573b43cc79
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_02_parse.md
@@ -0,0 +1,29 @@
+```console
+$ 04_02_parse_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_02_parse_derive[EXE] <PORT>
+
+Arguments:
+ <PORT> Network port to use
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_02_parse_derive 22
+PORT = 22
+
+$ 04_02_parse_derive foobar
+? failed
+error: invalid value 'foobar' for '<PORT>': invalid digit found in string
+
+For more information, try '--help'.
+
+$ 04_02_parse_derive 0
+? failed
+error: invalid value '0' for '<PORT>': 0 is not in 1..=65535
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_02_parse.rs b/third_party/rust/clap/examples/tutorial_derive/04_02_parse.rs
new file mode 100644
index 0000000000..a40c6828b6
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_02_parse.rs
@@ -0,0 +1,15 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// Network port to use
+ #[arg(value_parser = clap::value_parser!(u16).range(1..))]
+ port: u16,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("PORT = {}", cli.port);
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_02_validate.md b/third_party/rust/clap/examples/tutorial_derive/04_02_validate.md
new file mode 100644
index 0000000000..f8835fdca0
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_02_validate.md
@@ -0,0 +1,29 @@
+```console
+$ 04_02_validate_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_02_validate_derive[EXE] <PORT>
+
+Arguments:
+ <PORT> Network port to use
+
+Options:
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_02_validate_derive 22
+PORT = 22
+
+$ 04_02_validate_derive foobar
+? failed
+error: invalid value 'foobar' for '<PORT>': `foobar` isn't a port number
+
+For more information, try '--help'.
+
+$ 04_02_validate_derive 0
+? failed
+error: invalid value '0' for '<PORT>': port not in range 1-65535
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_02_validate.rs b/third_party/rust/clap/examples/tutorial_derive/04_02_validate.rs
new file mode 100644
index 0000000000..3391d5b72d
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_02_validate.rs
@@ -0,0 +1,34 @@
+use std::ops::RangeInclusive;
+
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// Network port to use
+ #[arg(value_parser = port_in_range)]
+ port: u16,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("PORT = {}", cli.port);
+}
+
+const PORT_RANGE: RangeInclusive<usize> = 1..=65535;
+
+fn port_in_range(s: &str) -> Result<u16, String> {
+ let port: usize = s
+ .parse()
+ .map_err(|_| format!("`{s}` isn't a port number"))?;
+ if PORT_RANGE.contains(&port) {
+ Ok(port as u16)
+ } else {
+ Err(format!(
+ "port not in range {}-{}",
+ PORT_RANGE.start(),
+ PORT_RANGE.end()
+ ))
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_03_relations.md b/third_party/rust/clap/examples/tutorial_derive/04_03_relations.md
new file mode 100644
index 0000000000..6eafb9fbbd
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_03_relations.md
@@ -0,0 +1,53 @@
+```console
+$ 04_03_relations_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_03_relations_derive[EXE] [OPTIONS] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+Arguments:
+ [INPUT_FILE] some regular input
+
+Options:
+ --set-ver <VER> set version manually
+ --major auto inc major
+ --minor auto inc minor
+ --patch auto inc patch
+ --spec-in <SPEC_IN> some special input argument
+ -c <CONFIG>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_03_relations_derive
+? failed
+error: the following required arguments were not provided:
+ <--set-ver <VER>|--major|--minor|--patch>
+
+Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_03_relations_derive --major
+Version: 2.2.3
+
+$ 04_03_relations_derive --major --minor
+? failed
+error: the argument '--major' cannot be used with '--minor'
+
+Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_03_relations_derive --major -c config.toml
+? failed
+error: the following required arguments were not provided:
+ <INPUT_FILE|--spec-in <SPEC_IN>>
+
+Usage: 04_03_relations_derive[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>
+
+For more information, try '--help'.
+
+$ 04_03_relations_derive --major -c config.toml --spec-in input.txt
+Version: 2.2.3
+Doing work using input input.txt and config config.toml
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_03_relations.rs b/third_party/rust/clap/examples/tutorial_derive/04_03_relations.rs
new file mode 100644
index 0000000000..8657ebe837
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_03_relations.rs
@@ -0,0 +1,75 @@
+use clap::{Args, Parser};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ #[command(flatten)]
+ vers: Vers,
+
+ /// some regular input
+ #[arg(group = "input")]
+ input_file: Option<String>,
+
+ /// some special input argument
+ #[arg(long, group = "input")]
+ spec_in: Option<String>,
+
+ #[arg(short, requires = "input")]
+ config: Option<String>,
+}
+
+#[derive(Args)]
+#[group(required = true, multiple = false)]
+struct Vers {
+ /// set version manually
+ #[arg(long, value_name = "VER")]
+ set_ver: Option<String>,
+
+ /// auto inc major
+ #[arg(long)]
+ major: bool,
+
+ /// auto inc minor
+ #[arg(long)]
+ minor: bool,
+
+ /// auto inc patch
+ #[arg(long)]
+ patch: bool,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ // Let's assume the old version 1.2.3
+ let mut major = 1;
+ let mut minor = 2;
+ let mut patch = 3;
+
+ // See if --set_ver was used to set the version manually
+ let vers = &cli.vers;
+ let version = if let Some(ver) = vers.set_ver.as_deref() {
+ ver.to_string()
+ } else {
+ // Increment the one requested (in a real program, we'd reset the lower numbers)
+ let (maj, min, pat) = (vers.major, vers.minor, vers.patch);
+ match (maj, min, pat) {
+ (true, _, _) => major += 1,
+ (_, true, _) => minor += 1,
+ (_, _, true) => patch += 1,
+ _ => unreachable!(),
+ };
+ format!("{major}.{minor}.{patch}")
+ };
+
+ println!("Version: {version}");
+
+ // Check for usage of -c
+ if let Some(config) = cli.config.as_deref() {
+ let input = cli
+ .input_file
+ .as_deref()
+ .unwrap_or_else(|| cli.spec_in.as_deref().unwrap());
+ println!("Doing work using input {input} and config {config}");
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_04_custom.md b/third_party/rust/clap/examples/tutorial_derive/04_04_custom.md
new file mode 100644
index 0000000000..c601e9fb4d
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_04_custom.md
@@ -0,0 +1,52 @@
+```console
+$ 04_04_custom_derive --help
+A simple to use, efficient, and full-featured Command Line Argument Parser
+
+Usage: 04_04_custom_derive[EXE] [OPTIONS] [INPUT_FILE]
+
+Arguments:
+ [INPUT_FILE] some regular input
+
+Options:
+ --set-ver <VER> set version manually
+ --major auto inc major
+ --minor auto inc minor
+ --patch auto inc patch
+ --spec-in <SPEC_IN> some special input argument
+ -c <CONFIG>
+ -h, --help Print help
+ -V, --version Print version
+
+$ 04_04_custom_derive
+? failed
+error: Can only modify one version field
+
+Usage: clap [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom_derive --major
+Version: 2.2.3
+
+$ 04_04_custom_derive --major --minor
+? failed
+error: Can only modify one version field
+
+Usage: clap [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom_derive --major -c config.toml
+? failed
+Version: 2.2.3
+error: INPUT_FILE or --spec-in is required when using --config
+
+Usage: clap [OPTIONS] [INPUT_FILE]
+
+For more information, try '--help'.
+
+$ 04_04_custom_derive --major -c config.toml --spec-in input.txt
+Version: 2.2.3
+Doing work using input input.txt and config config.toml
+
+```
diff --git a/third_party/rust/clap/examples/tutorial_derive/04_04_custom.rs b/third_party/rust/clap/examples/tutorial_derive/04_04_custom.rs
new file mode 100644
index 0000000000..a84b5ed5fe
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/04_04_custom.rs
@@ -0,0 +1,91 @@
+use clap::error::ErrorKind;
+use clap::{CommandFactory, Parser};
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// set version manually
+ #[arg(long, value_name = "VER")]
+ set_ver: Option<String>,
+
+ /// auto inc major
+ #[arg(long)]
+ major: bool,
+
+ /// auto inc minor
+ #[arg(long)]
+ minor: bool,
+
+ /// auto inc patch
+ #[arg(long)]
+ patch: bool,
+
+ /// some regular input
+ input_file: Option<String>,
+
+ /// some special input argument
+ #[arg(long)]
+ spec_in: Option<String>,
+
+ #[arg(short)]
+ config: Option<String>,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ // Let's assume the old version 1.2.3
+ let mut major = 1;
+ let mut minor = 2;
+ let mut patch = 3;
+
+ // See if --set-ver was used to set the version manually
+ let version = if let Some(ver) = cli.set_ver.as_deref() {
+ if cli.major || cli.minor || cli.patch {
+ let mut cmd = Cli::command();
+ cmd.error(
+ ErrorKind::ArgumentConflict,
+ "Can't do relative and absolute version change",
+ )
+ .exit();
+ }
+ ver.to_string()
+ } else {
+ // Increment the one requested (in a real program, we'd reset the lower numbers)
+ let (maj, min, pat) = (cli.major, cli.minor, cli.patch);
+ match (maj, min, pat) {
+ (true, false, false) => major += 1,
+ (false, true, false) => minor += 1,
+ (false, false, true) => patch += 1,
+ _ => {
+ let mut cmd = Cli::command();
+ cmd.error(
+ ErrorKind::ArgumentConflict,
+ "Can only modify one version field",
+ )
+ .exit();
+ }
+ };
+ format!("{major}.{minor}.{patch}")
+ };
+
+ println!("Version: {version}");
+
+ // Check for usage of -c
+ if let Some(config) = cli.config.as_deref() {
+ let input = cli
+ .input_file
+ .as_deref()
+ // 'or' is preferred to 'or_else' here since `Option::as_deref` is 'const'
+ .or(cli.spec_in.as_deref())
+ .unwrap_or_else(|| {
+ let mut cmd = Cli::command();
+ cmd.error(
+ ErrorKind::MissingRequiredArgument,
+ "INPUT_FILE or --spec-in is required when using --config",
+ )
+ .exit()
+ });
+ println!("Doing work using input {input} and config {config}");
+ }
+}
diff --git a/third_party/rust/clap/examples/tutorial_derive/05_01_assert.rs b/third_party/rust/clap/examples/tutorial_derive/05_01_assert.rs
new file mode 100644
index 0000000000..42ebda9a1e
--- /dev/null
+++ b/third_party/rust/clap/examples/tutorial_derive/05_01_assert.rs
@@ -0,0 +1,20 @@
+use clap::Parser;
+
+#[derive(Parser)]
+#[command(author, version, about, long_about = None)]
+struct Cli {
+ /// Network port to use
+ port: u16,
+}
+
+fn main() {
+ let cli = Cli::parse();
+
+ println!("PORT = {}", cli.port);
+}
+
+#[test]
+fn verify_cli() {
+ use clap::CommandFactory;
+ Cli::command().debug_assert()
+}
diff --git a/third_party/rust/clap/examples/typed-derive.md b/third_party/rust/clap/examples/typed-derive.md
new file mode 100644
index 0000000000..9221a310da
--- /dev/null
+++ b/third_party/rust/clap/examples/typed-derive.md
@@ -0,0 +1,131 @@
+**This requires enabling the [`derive` feature flag][crate::_features].**
+
+Help:
+```console
+$ typed-derive --help
+Usage: typed-derive[EXE] [OPTIONS]
+
+Options:
+ -O <OPTIMIZATION> Implicitly using `std::str::FromStr`
+ -I <DIR> Allow invalid UTF-8 paths
+ --bind <BIND> Handle IP addresses
+ --sleep <SLEEP> Allow human-readable durations
+ -D <DEFINES> Hand-written parser for tuples
+ --port <PORT> Support for discrete numbers [default: 22] [possible values: 22, 80]
+ --log-level <LOG_LEVEL> Support enums from a foreign crate that don't implement `ValueEnum` [default: info] [possible values: trace, debug, info, warn, error]
+ -h, --help Print help
+
+```
+
+Optimization-level (number)
+```console
+$ typed-derive -O 1
+Args { optimization: Some(1), include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Info }
+
+$ typed-derive -O plaid
+? failed
+error: invalid value 'plaid' for '-O <OPTIMIZATION>': invalid digit found in string
+
+For more information, try '--help'.
+
+```
+
+Include (path)
+```console
+$ typed-derive -I../hello
+Args { optimization: None, include: Some("../hello"), bind: None, sleep: None, defines: [], port: 22, log_level: Info }
+
+```
+
+IP Address
+```console
+$ typed-derive --bind 192.0.0.1
+Args { optimization: None, include: None, bind: Some(192.0.0.1), sleep: None, defines: [], port: 22, log_level: Info }
+
+$ typed-derive --bind localhost
+? failed
+error: invalid value 'localhost' for '--bind <BIND>': invalid IP address syntax
+
+For more information, try '--help'.
+
+```
+
+Time
+```console
+$ typed-derive --sleep 10s
+Args { optimization: None, include: None, bind: None, sleep: Some(Duration(10s)), defines: [], port: 22, log_level: Info }
+
+$ typed-derive --sleep forever
+? failed
+error: invalid value 'forever' for '--sleep <SLEEP>': expected number at 0
+
+For more information, try '--help'.
+
+```
+
+Defines (key-value pairs)
+```console
+$ typed-derive -D Foo=10 -D Alice=30
+Args { optimization: None, include: None, bind: None, sleep: None, defines: [("Foo", 10), ("Alice", 30)], port: 22, log_level: Info }
+
+$ typed-derive -D Foo
+? failed
+error: invalid value 'Foo' for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo`
+
+For more information, try '--help'.
+
+$ typed-derive -D Foo=Bar
+? failed
+error: invalid value 'Foo=Bar' for '-D <DEFINES>': invalid digit found in string
+
+For more information, try '--help'.
+
+```
+
+Discrete numbers
+```console
+$ typed-derive --port 22
+Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Info }
+
+$ typed-derive --port 80
+Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 80, log_level: Info }
+
+$ typed-derive --port
+? failed
+error: a value is required for '--port <PORT>' but none was supplied
+ [possible values: 22, 80]
+
+For more information, try '--help'.
+
+$ typed-derive --port 3000
+? failed
+error: invalid value '3000' for '--port <PORT>'
+ [possible values: 22, 80]
+
+For more information, try '--help'.
+
+```
+
+Enums from crates that can't implement `ValueEnum`
+```console
+$ typed-derive --log-level debug
+Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Debug }
+
+$ typed-derive --log-level error
+Args { optimization: None, include: None, bind: None, sleep: None, defines: [], port: 22, log_level: Error }
+
+$ typed-derive --log-level
+? failed
+error: a value is required for '--log-level <LOG_LEVEL>' but none was supplied
+ [possible values: trace, debug, info, warn, error]
+
+For more information, try '--help'.
+
+$ typed-derive --log-level critical
+? failed
+error: invalid value 'critical' for '--log-level <LOG_LEVEL>'
+ [possible values: trace, debug, info, warn, error]
+
+For more information, try '--help'.
+
+```
diff --git a/third_party/rust/clap/examples/typed-derive.rs b/third_party/rust/clap/examples/typed-derive.rs
new file mode 100644
index 0000000000..1a36f11d5b
--- /dev/null
+++ b/third_party/rust/clap/examples/typed-derive.rs
@@ -0,0 +1,102 @@
+use clap::builder::TypedValueParser as _;
+use clap::Parser;
+use std::error::Error;
+
+#[derive(Parser, Debug)] // requires `derive` feature
+#[command(term_width = 0)] // Just to make testing across clap features easier
+struct Args {
+ /// Implicitly using `std::str::FromStr`
+ #[arg(short = 'O')]
+ optimization: Option<usize>,
+
+ /// Allow invalid UTF-8 paths
+ #[arg(short = 'I', value_name = "DIR", value_hint = clap::ValueHint::DirPath)]
+ include: Option<std::path::PathBuf>,
+
+ /// Handle IP addresses
+ #[arg(long)]
+ bind: Option<std::net::IpAddr>,
+
+ /// Allow human-readable durations
+ #[arg(long)]
+ sleep: Option<humantime::Duration>,
+
+ /// Hand-written parser for tuples
+ #[arg(short = 'D', value_parser = parse_key_val::<String, i32>)]
+ defines: Vec<(String, i32)>,
+
+ /// Support for discrete numbers
+ #[arg(
+ long,
+ default_value_t = 22,
+ value_parser = clap::builder::PossibleValuesParser::new(["22", "80"])
+ .map(|s| s.parse::<usize>().unwrap()),
+ )]
+ port: usize,
+
+ /// Support enums from a foreign crate that don't implement `ValueEnum`
+ #[arg(
+ long,
+ default_value_t = foreign_crate::LogLevel::Info,
+ value_parser = clap::builder::PossibleValuesParser::new(["trace", "debug", "info", "warn", "error"])
+ .map(|s| s.parse::<foreign_crate::LogLevel>().unwrap()),
+ )]
+ log_level: foreign_crate::LogLevel,
+}
+
+/// Parse a single key-value pair
+fn parse_key_val<T, U>(s: &str) -> Result<(T, U), Box<dyn Error + Send + Sync + 'static>>
+where
+ T: std::str::FromStr,
+ T::Err: Error + Send + Sync + 'static,
+ U: std::str::FromStr,
+ U::Err: Error + Send + Sync + 'static,
+{
+ let pos = s
+ .find('=')
+ .ok_or_else(|| format!("invalid KEY=value: no `=` found in `{s}`"))?;
+ Ok((s[..pos].parse()?, s[pos + 1..].parse()?))
+}
+
+mod foreign_crate {
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
+ pub enum LogLevel {
+ Trace,
+ Debug,
+ Info,
+ Warn,
+ Error,
+ }
+
+ impl std::fmt::Display for LogLevel {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let s = match self {
+ Self::Trace => "trace",
+ Self::Debug => "debug",
+ Self::Info => "info",
+ Self::Warn => "warn",
+ Self::Error => "error",
+ };
+ s.fmt(f)
+ }
+ }
+ impl std::str::FromStr for LogLevel {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ "trace" => Ok(Self::Trace),
+ "debug" => Ok(Self::Debug),
+ "info" => Ok(Self::Info),
+ "warn" => Ok(Self::Warn),
+ "error" => Ok(Self::Error),
+ _ => Err(format!("Unknown log level: {s}")),
+ }
+ }
+ }
+}
+
+fn main() {
+ let args = Args::parse();
+ println!("{args:?}");
+}
diff --git a/third_party/rust/clap/src/_cookbook/cargo_example.rs b/third_party/rust/clap/src/_cookbook/cargo_example.rs
new file mode 100644
index 0000000000..ec5d582db0
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/cargo_example.rs
@@ -0,0 +1,7 @@
+//! # Example: cargo subcommand (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/cargo-example.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/cargo-example.md")]
diff --git a/third_party/rust/clap/src/_cookbook/cargo_example_derive.rs b/third_party/rust/clap/src/_cookbook/cargo_example_derive.rs
new file mode 100644
index 0000000000..d49f956f9c
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/cargo_example_derive.rs
@@ -0,0 +1,7 @@
+//! # Example: cargo subcommand (Derive API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/cargo-example-derive.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/cargo-example-derive.md")]
diff --git a/third_party/rust/clap/src/_cookbook/escaped_positional.rs b/third_party/rust/clap/src/_cookbook/escaped_positional.rs
new file mode 100644
index 0000000000..99a3f83f3b
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/escaped_positional.rs
@@ -0,0 +1,7 @@
+//! # Example (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/escaped-positional.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/escaped-positional.md")]
diff --git a/third_party/rust/clap/src/_cookbook/escaped_positional_derive.rs b/third_party/rust/clap/src/_cookbook/escaped_positional_derive.rs
new file mode 100644
index 0000000000..e6f99ad171
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/escaped_positional_derive.rs
@@ -0,0 +1,7 @@
+//! # Example (Derive API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/escaped-positional-derive.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/escaped-positional-derive.md")]
diff --git a/third_party/rust/clap/src/_cookbook/find.rs b/third_party/rust/clap/src/_cookbook/find.rs
new file mode 100644
index 0000000000..2ca11c665d
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/find.rs
@@ -0,0 +1,7 @@
+//! # Example: find-like CLI (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/find.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/find.md")]
diff --git a/third_party/rust/clap/src/_cookbook/git.rs b/third_party/rust/clap/src/_cookbook/git.rs
new file mode 100644
index 0000000000..03a926ca85
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/git.rs
@@ -0,0 +1,7 @@
+//! # Example: git-like CLI (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/git.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/git.md")]
diff --git a/third_party/rust/clap/src/_cookbook/git_derive.rs b/third_party/rust/clap/src/_cookbook/git_derive.rs
new file mode 100644
index 0000000000..d3119736de
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/git_derive.rs
@@ -0,0 +1,7 @@
+//! # Example: git-like CLI (Derive API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/git-derive.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/git-derive.md")]
diff --git a/third_party/rust/clap/src/_cookbook/mod.rs b/third_party/rust/clap/src/_cookbook/mod.rs
new file mode 100644
index 0000000000..dacb1219a8
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/mod.rs
@@ -0,0 +1,61 @@
+// Contributing
+//
+// New examples:
+// - Building: They must be added to `Cargo.toml` with the appropriate `required-features`.
+// - Testing: Ensure there is a markdown file with [trycmd](https://docs.rs/trycmd) syntax
+// - Link the `.md` file from here
+
+//! # Documentation: Cookbook
+//!
+//! Typed arguments: [derive][typed_derive]
+//! - Topics:
+//! - Custom `parse()`
+//!
+//! Custom cargo command: [builder][cargo_example], [derive][cargo_example_derive]
+//! - Topics:
+//! - Subcommands
+//! - Cargo plugins
+//!
+//! find-like interface: [builder][find]
+//! - Topics:
+//! - Position-sensitive flags
+//!
+//! git-like interface: [builder][git], [derive][git_derive]
+//! - Topics:
+//! - Subcommands
+//! - External subcommands
+//! - Optional subcommands
+//! - Default subcommands
+//! - [`last`][crate::Arg::last]
+//!
+//! pacman-like interface: [builder][pacman]
+//! - Topics:
+//! - Flag subcommands
+//! - Conflicting arguments
+//!
+//! Escaped positionals with `--`: [builder][escaped_positional], [derive][escaped_positional_derive]
+//!
+//! Multi-call
+//! - busybox: [builder][multicall_busybox]
+//! - Topics:
+//! - Subcommands
+//! - hostname: [builder][multicall_hostname]
+//! - Topics:
+//! - Subcommands
+//!
+//! repl: [builder][repl]
+//! - Topics:
+//! - Read-Eval-Print Loops / Custom command lines
+
+pub mod cargo_example;
+pub mod cargo_example_derive;
+pub mod escaped_positional;
+pub mod escaped_positional_derive;
+pub mod find;
+pub mod git;
+pub mod git_derive;
+pub mod multicall_busybox;
+pub mod multicall_hostname;
+pub mod pacman;
+pub mod repl;
+pub mod typed_derive;
diff --git a/third_party/rust/clap/src/_cookbook/multicall_busybox.rs b/third_party/rust/clap/src/_cookbook/multicall_busybox.rs
new file mode 100644
index 0000000000..e3384d682f
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/multicall_busybox.rs
@@ -0,0 +1,7 @@
+//! # Example: busybox-like CLI (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/multicall-busybox.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/multicall-busybox.md")]
diff --git a/third_party/rust/clap/src/_cookbook/multicall_hostname.rs b/third_party/rust/clap/src/_cookbook/multicall_hostname.rs
new file mode 100644
index 0000000000..9777654dc1
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/multicall_hostname.rs
@@ -0,0 +1,7 @@
+//! # Example: hostname-like CLI (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/multicall-hostname.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/multicall-hostname.md")]
diff --git a/third_party/rust/clap/src/_cookbook/pacman.rs b/third_party/rust/clap/src/_cookbook/pacman.rs
new file mode 100644
index 0000000000..880c58158b
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/pacman.rs
@@ -0,0 +1,7 @@
+//! # Example: pacman-like CLI (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/pacman.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/pacman.md")]
diff --git a/third_party/rust/clap/src/_cookbook/repl.rs b/third_party/rust/clap/src/_cookbook/repl.rs
new file mode 100644
index 0000000000..549ec82590
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/repl.rs
@@ -0,0 +1,5 @@
+//! # Example: Command REPL (Builder API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/repl.rs")]
+//! ```
diff --git a/third_party/rust/clap/src/_cookbook/typed_derive.rs b/third_party/rust/clap/src/_cookbook/typed_derive.rs
new file mode 100644
index 0000000000..a5fd15ff84
--- /dev/null
+++ b/third_party/rust/clap/src/_cookbook/typed_derive.rs
@@ -0,0 +1,7 @@
+//! # Example: Custom Types (Derive API)
+//!
+//! ```rust
+#![doc = include_str!("../../examples/typed-derive.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/typed-derive.md")]
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_0.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_0.rs
new file mode 100644
index 0000000000..d6806949c8
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_0.rs
@@ -0,0 +1,25 @@
+//! ## Quick Start
+//!
+//! You can create an application declaratively with a `struct` and some
+//! attributes.
+//!
+//! First, ensure `clap` is available with the [`derive` feature flag][crate::_features]:
+//! ```console
+//! $ cargo add clap --features derive
+//! ```
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/01_quick.rs")]
+//! ```
+//!
+#![doc = include_str!("../../../examples/tutorial_derive/01_quick.md")]
+//!
+//! See also
+//! - [FAQ: When should I use the builder vs derive APIs?][crate::_faq#when-should-i-use-the-builder-vs-derive-apis]
+//! - The [cookbook][crate::_cookbook] for more application-focused examples
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_1 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_1.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_1.rs
new file mode 100644
index 0000000000..b58ae6e0c2
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_1.rs
@@ -0,0 +1,29 @@
+//! ## Configuring the Parser
+//!
+//! You use derive [`Parser`][crate::Parser] to start building a parser.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/02_apps.rs")]
+//! ```
+//!
+#![doc = include_str!("../../../examples/tutorial_derive/02_apps.md")]
+//!
+//! You can use [`#[command(author, version, about)]` attribute defaults][super#command-attributes] on the struct to fill these fields in from your `Cargo.toml` file.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/02_crate.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/02_crate.md")]
+//!
+//! You can use `#[command]` attributes on the struct to change the application level behavior of clap. Any [`Command`][crate::Command] builder function can be used as an attribute, like [`Command::next_line_help`].
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/02_app_settings.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_0 as previous;
+pub use super::chapter_2 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_2.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_2.rs
new file mode 100644
index 0000000000..95d02f8513
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_2.rs
@@ -0,0 +1,103 @@
+//! ## Adding Arguments
+//!
+//! 1. [Positionals](#positionals)
+//! 2. [Options](#options)
+//! 3. [Flags](#flags)
+//! 4. [Subcommands](#subcommands)
+//! 5. [Defaults](#defaults)
+//!
+//! Arguments are inferred from the fields of your struct.
+//!
+//! ### Positionals
+//!
+//! You can have users specify values by their position on the command-line:
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_03_positional.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_03_positional.md")]
+//!
+//! Note that the [default `ArgAction` is `Set`][super#arg-types]. To
+//! accept multiple values, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append] via `Vec`:
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_03_positional_mult.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_03_positional_mult.md")]
+//!
+//! ### Options
+//!
+//! You can name your arguments with a flag:
+//! - Order doesn't matter
+//! - They can be optional
+//! - Intent is clearer
+//!
+//! To specify the flags for an argument, you can use [`#[arg(short = 'n')]`][Arg::short] and/or
+//! [`#[arg(long = "name")]`][Arg::long] attributes on a field. When no value is given (e.g.
+//! `#[arg(short)]`), the flag is inferred from the field's name.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_02_option.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_02_option.md")]
+//!
+//! Note that the [default `ArgAction` is `Set`][super#arg-types]. To
+//! accept multiple occurrences, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append] via `Vec`:
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_02_option_mult.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_02_option_mult.md")]
+//!
+//! ### Flags
+//!
+//! Flags can also be switches that can be on/off:
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_01_flag_bool.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_01_flag_bool.md")]
+//!
+//! Note that the [default `ArgAction` for a `bool` field is
+//! `SetTrue`][super#arg-types]. To accept multiple flags, override the [action][Arg::action] with
+//! [`Count`][crate::ArgAction::Count]:
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_01_flag_count.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_01_flag_count.md")]
+//!
+//! This also shows that any[`Arg`][crate::Args] method may be used as an attribute.
+//!
+//! ### Subcommands
+//!
+//! Subcommands are derived with `#[derive(Subcommand)]` and be added via
+//! [`#[command(subcommand)]` attribute][super#command-attributes] on the field using that type.
+//! Each instance of a [Subcommand][crate::Subcommand] can have its own version, author(s), Args,
+//! and even its own subcommands.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_04_subcommands.rs")]
+//! ```
+//! We used a struct-variant to define the `add` subcommand.
+//! Alternatively, you can use a struct for your subcommand's arguments:
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_04_subcommands_alt.rs")]
+//! ```
+//!
+#![doc = include_str!("../../../examples/tutorial_derive/03_04_subcommands.md")]
+//!
+//! ### Defaults
+//!
+//! We've previously showed that arguments can be [`required`][crate::Arg::required] or optional.
+//! When optional, you work with a `Option` and can `unwrap_or`. Alternatively, you can
+//! set [`#[arg(default_value_t)]`][super#arg-attributes].
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/03_05_default_values.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/03_05_default_values.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_1 as previous;
+pub use super::chapter_3 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_3.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_3.rs
new file mode 100644
index 0000000000..16004fcdcd
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_3.rs
@@ -0,0 +1,78 @@
+//! ## Validation
+//!
+//! 1. [Enumerated values](#enumerated-values)
+//! 2. [Validated values](#validated-values)
+//! 3. [Argument Relations](#argument-relations)
+//! 4. [Custom Validation](#custom-validation)
+//!
+//! An appropriate default parser/validator will be selected for the field's type. See
+//! [`value_parser!`][crate::value_parser!] for more details.
+//!
+//! ### Enumerated values
+//!
+//! For example, if you have arguments of specific values you want to test for, you can derive
+//! [`ValueEnum`][super#valueenum-attributes]
+//! (any [`PossibleValue`] builder function can be used as a `#[value]` attribute on enum variants).
+//!
+//! This allows you specify the valid values for that argument. If the user does not use one of
+//! those specific values, they will receive a graceful exit with error message informing them
+//! of the mistake, and what the possible valid values are
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/04_01_enum.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/04_01_enum.md")]
+//!
+//! ### Validated values
+//!
+//! More generally, you can validate and parse into any data type with [`Arg::value_parser`].
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/04_02_parse.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/04_02_parse.md")]
+//!
+//! A [custom parser][TypedValueParser] can be used to improve the error messages or provide additional validation:
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/04_02_validate.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/04_02_validate.md")]
+//!
+//! See [`Arg::value_parser`][crate::Arg::value_parser] for more details.
+//!
+//! ### Argument Relations
+//!
+//! You can declare dependencies or conflicts between [`Arg`][crate::Arg]s or even
+//! [`ArgGroup`][crate::ArgGroup]s.
+//!
+//! [`ArgGroup`][crate::ArgGroup]s make it easier to declare relations instead of having to list
+//! each individually, or when you want a rule to apply "any but not all" arguments.
+//!
+//! Perhaps the most common use of [`ArgGroup`][crate::ArgGroup]s is to require one and *only* one
+//! argument to be present out of a given set. Imagine that you had multiple arguments, and you
+//! want one of them to be required, but making all of them required isn't feasible because perhaps
+//! they conflict with each other.
+//!
+//! [`ArgGroup`][crate::ArgGroup]s are automatically created for a `struct` with its
+//! [`ArgGroup::id`][crate::ArgGroup::id] being the struct's name.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/04_03_relations.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/04_03_relations.md")]
+//!
+//! ### Custom Validation
+//!
+//! As a last resort, you can create custom errors with the basics of clap's formatting.
+//!
+//! ```rust
+#![doc = include_str!("../../../examples/tutorial_derive/04_04_custom.rs")]
+//! ```
+#![doc = include_str!("../../../examples/tutorial_derive/04_04_custom.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_2 as previous;
+pub use super::chapter_4 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_4.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_4.rs
new file mode 100644
index 0000000000..86c5368e9a
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_4.rs
@@ -0,0 +1,15 @@
+//! ## Testing
+//!
+//! clap reports most development errors as `debug_assert!`s. Rather than checking every
+//! subcommand, you should have a test that calls
+//! [`Command::debug_assert`][crate::Command::debug_assert]:
+//! ```rust,no_run
+#![doc = include_str!("../../../examples/tutorial_derive/05_01_assert.rs")]
+//! ```
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_3 as previous;
+pub use super::chapter_5 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/chapter_5.rs b/third_party/rust/clap/src/_derive/_tutorial/chapter_5.rs
new file mode 100644
index 0000000000..c586392872
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/chapter_5.rs
@@ -0,0 +1,14 @@
+//! ## Next Steps
+//!
+//! - [Cookbook][crate::_cookbook] for application-focused examples
+//! - Explore more features in the [Derive reference][super]
+//! - See also [`Command`], [`Arg`], [`ArgGroup`], and [`PossibleValue`] builder functions which
+//! can be used as attributes
+//!
+//! For support, see [Discussions](https://github.com/clap-rs/clap/discussions)
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_4 as previous;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_derive/_tutorial/mod.rs b/third_party/rust/clap/src/_derive/_tutorial/mod.rs
new file mode 100644
index 0000000000..f48a64e8bd
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/_tutorial/mod.rs
@@ -0,0 +1,36 @@
+// Contributing
+//
+// New example code:
+// - Please update the corresponding section in the derive tutorial
+// - Building: They must be added to `Cargo.toml` with the appropriate `required-features`.
+// - Testing: Ensure there is a markdown file with [trycmd](https://docs.rs/trycmd) syntax
+//
+// See also the general CONTRIBUTING
+
+//! # Documentation: Derive Tutorial
+//!
+//! 1. [Quick Start][chapter_0]
+//! 2. [Configuring the Parser][chapter_1]
+//! 3. [Adding Arguments][chapter_2]
+//! 1. [Positionals][chapter_2#positionals]
+//! 2. [Options][chapter_2#options]
+//! 3. [Flags][chapter_2#flags]
+//! 4. [Subcommands][chapter_2#subcommands]
+//! 5. [Defaults][chapter_2#defaults]
+//! 4. [Validation][chapter_3]
+//! 1. [Enumerated values][chapter_3#enumerated-values]
+//! 2. [Validated values][chapter_3#validated-values]
+//! 3. [Argument Relations][chapter_3#argument-relations]
+//! 4. [Custom Validation][chapter_3#custom-validation]
+//! 5. [Testing][chapter_4]
+//! 6. [Next Steps][chapter_5]
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub mod chapter_0;
+pub mod chapter_1;
+pub mod chapter_2;
+pub mod chapter_3;
+pub mod chapter_4;
+pub mod chapter_5;
diff --git a/third_party/rust/clap/src/_derive/mod.rs b/third_party/rust/clap/src/_derive/mod.rs
new file mode 100644
index 0000000000..0c479a2369
--- /dev/null
+++ b/third_party/rust/clap/src/_derive/mod.rs
@@ -0,0 +1,504 @@
+//! # Documentation: Derive Reference
+//!
+//! 1. [Overview](#overview)
+//! 2. [Attributes](#attributes)
+//! 1. [Terminology](#terminology)
+//! 2. [Command Attributes](#command-attributes)
+//! 2. [ArgGroup Attributes](#arggroup-attributes)
+//! 3. [Arg Attributes](#arg-attributes)
+//! 4. [ValueEnum Attributes](#valueenum-attributes)
+//! 5. [Possible Value Attributes](#possible-value-attributes)
+//! 3. [Arg Types](#arg-types)
+//! 4. [Doc Comments](#doc-comments)
+//! 5. [Mixing Builder and Derive APIs](#mixing-builder-and-derive-apis)
+//! 6. [Tips](#tips)
+//!
+//! ## Overview
+//!
+//! To derive `clap` types, you need to enable the [`derive` feature flag][crate::_features].
+//!
+//! Example:
+//! ```rust
+#![doc = include_str!("../../examples/demo.rs")]
+//! ```
+//!
+//! Let's start by breaking down the anatomy of the derive attributes:
+//! ```rust
+//! use clap::{Parser, Args, Subcommand, ValueEnum};
+//!
+//! /// Doc comment
+//! #[derive(Parser)]
+//! #[command(CMD ATTRIBUTE)]
+//! #[group(GROUP ATTRIBUTE)]
+//! struct Cli {
+//! /// Doc comment
+//! #[arg(ARG ATTRIBUTE)]
+//! field: UserType,
+//!
+//! #[arg(value_enum, ARG ATTRIBUTE...)]
+//! field: EnumValues,
+//!
+//! #[command(flatten)]
+//! delegate: Struct,
+//!
+//! #[command(subcommand)]
+//! command: Command,
+//! }
+//!
+//! /// Doc comment
+//! #[derive(Args)]
+//! #[command(PARENT CMD ATTRIBUTE)]
+//! #[group(GROUP ATTRIBUTE)]
+//! struct Struct {
+//! /// Doc comment
+//! #[command(ARG ATTRIBUTE)]
+//! field: UserType,
+//! }
+//!
+//! /// Doc comment
+//! #[derive(Subcommand)]
+//! #[command(PARENT CMD ATTRIBUTE)]
+//! enum Command {
+//! /// Doc comment
+//! #[command(CMD ATTRIBUTE)]
+//! Variant1(Struct),
+//!
+//! /// Doc comment
+//! #[command(CMD ATTRIBUTE)]
+//! Variant2 {
+//! /// Doc comment
+//! #[arg(ARG ATTRIBUTE)]
+//! field: UserType,
+//! }
+//! }
+//!
+//! /// Doc comment
+//! #[derive(ValueEnum)]
+//! #[value(VALUE ENUM ATTRIBUTE)]
+//! enum EnumValues {
+//! /// Doc comment
+//! #[value(POSSIBLE VALUE ATTRIBUTE)]
+//! Variant1,
+//! }
+//!
+//! fn main() {
+//! let cli = Cli::parse();
+//! }
+//! ```
+//!
+//! Traits:
+//! - [`Parser`][crate::Parser] parses arguments into a `struct` (arguments) or `enum` (subcommands).
+//! - [`Args`][crate::Args] allows defining a set of re-usable arguments that get merged into their parent container.
+//! - [`Subcommand`][crate::Subcommand] defines available subcommands.
+//! - Subcommand arguments can be defined in a struct-variant or automatically flattened with a tuple-variant.
+//! - [`ValueEnum`][crate::ValueEnum] allows parsing a value directly into an `enum`, erroring on unsupported values.
+//! - The derive doesn't work on enums that contain non-unit variants, unless they are skipped
+//!
+//! *See also the [derive tutorial][crate::_derive::_tutorial] and [cookbook][crate::_cookbook]*
+//!
+//! ## Attributes
+//!
+//! ### Terminology
+//!
+//! **Raw attributes** are forwarded directly to the underlying [`clap` builder][crate::builder]. Any
+//! [`Command`][crate::Command], [`Arg`][crate::Arg], or [`PossibleValue`][crate::builder::PossibleValue] method can be used as an attribute.
+//!
+//! Raw attributes come in two different syntaxes:
+//! ```rust,ignore
+//! #[arg(
+//! global = true, // name = arg form, neat for one-arg methods
+//! required_if_eq("out", "file") // name(arg1, arg2, ...) form.
+//! )]
+//! ```
+//!
+//! - `method = arg` can only be used for methods which take only one argument.
+//! - `method(arg1, arg2)` can be used with any method.
+//!
+//! As long as `method_name` is not one of the magical methods it will be
+//! translated into a mere method call.
+//!
+//! **Magic attributes** have post-processing done to them, whether that is
+//! - Providing of defaults
+//! - Special behavior is triggered off of it
+//!
+//! Magic attributes are more constrained in the syntax they support, usually just
+//! `<attr> = <value>` though some use `<attr>(<value>)` instead. See the specific
+//! magic attributes documentation for details. This allows users to access the
+//! raw behavior of an attribute via `<attr>(<value>)` syntax.
+//!
+//! **NOTE:** Some attributes are inferred from [Arg Types](#arg-types) and [Doc
+//! Comments](#doc-comments). Explicit attributes take precedence over inferred
+//! attributes.
+//!
+//! ### Command Attributes
+//!
+//! These correspond to a [`Command`][crate::Command] which is used for both top-level parsers and
+//! when defining subcommands.
+//!
+//! **Raw attributes:** Any [`Command` method][crate::Command] can also be used as an attribute,
+//! see [Terminology](#terminology) for syntax.
+//! - e.g. `#[command(arg_required_else_help(true))]` would translate to `cmd.arg_required_else_help(true)`
+//!
+//! **Magic attributes:**
+//! - `name = <expr>`: [`Command::name`][crate::Command::name]
+//! - When not present: [package `name`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field) (if on [`Parser`][crate::Parser] container), variant name (if on [`Subcommand`][crate::Subcommand] variant)
+//! - `version [= <expr>]`: [`Command::version`][crate::Command::version]
+//! - When not present: no version set
+//! - Without `<expr>`: defaults to [crate `version`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field)
+//! - `author [= <expr>]`: [`Command::author`][crate::Command::author]
+//! - When not present: no author set
+//! - Without `<expr>`: defaults to [crate `authors`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field)
+//! - `about [= <expr>]`: [`Command::about`][crate::Command::about]
+//! - When not present: [Doc comment summary](#doc-comments)
+//! - Without `<expr>`: [crate `description`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-description-field) ([`Parser`][crate::Parser] container)
+//! - **TIP:** When a doc comment is also present, you most likely want to add
+//! `#[arg(long_about = None)]` to clear the doc comment so only [`about`][crate::Command::about]
+//! gets shown with both `-h` and `--help`.
+//! - `long_about[ = <expr>]`: [`Command::long_about`][crate::Command::long_about]
+//! - When not present: [Doc comment](#doc-comments) if there is a blank line, else nothing
+//! - When present without a value: [Doc comment](#doc-comments)
+//! - `verbatim_doc_comment`: Minimizes pre-processing when converting doc comments to [`about`][crate::Command::about] / [`long_about`][crate::Command::long_about]
+//! - `next_display_order`: [`Command::next_display_order`][crate::Command::next_display_order]
+//! - `next_help_heading`: [`Command::next_help_heading`][crate::Command::next_help_heading]
+//! - When `flatten`ing [`Args`][crate::Args], this is scoped to just the args in this struct and any struct `flatten`ed into it
+//! - `rename_all = <string_literal>`: Override default field / variant name case conversion for [`Command::name`][crate::Command::name] / [`Arg::id`][crate::Arg::id]
+//! - When not present: `"kebab-case"`
+//! - Available values: `"camelCase"`, `"kebab-case"`, `"PascalCase"`, `"SCREAMING_SNAKE_CASE"`, `"snake_case"`, `"lower"`, `"UPPER"`, `"verbatim"`
+//! - `rename_all_env = <string_literal>`: Override default field name case conversion for env variables for [`Arg::env`][crate::Arg::env]
+//! - When not present: `"SCREAMING_SNAKE_CASE"`
+//! - Available values: `"camelCase"`, `"kebab-case"`, `"PascalCase"`, `"SCREAMING_SNAKE_CASE"`, `"snake_case"`, `"lower"`, `"UPPER"`, `"verbatim"`
+//!
+//! And for [`Subcommand`][crate::Subcommand] variants:
+//! - `skip`: Ignore this variant
+//! - `flatten`: Delegates to the variant for more subcommands (must implement
+//! [`Subcommand`][crate::Subcommand])
+//! - `subcommand`: Nest subcommands under the current set of subcommands (must implement
+//! [`Subcommand`][crate::Subcommand])
+//! - `external_subcommand`: [`Command::allow_external_subcommand(true)`][crate::Command::allow_external_subcommands]
+//! - Variant must be either `Variant(Vec<String>)` or `Variant(Vec<OsString>)`
+//!
+//! And for [`Args`][crate::Args] fields:
+//! - `flatten`: Delegates to the field for more arguments (must implement [`Args`][crate::Args])
+//! - Only [`next_help_heading`][crate::Command::next_help_heading] can be used with `flatten`. See
+//! [clap-rs/clap#3269](https://github.com/clap-rs/clap/issues/3269) for why
+//! arg attributes are not generally supported.
+//! - **Tip:** Though we do apply a flattened [`Args`][crate::Args]'s Parent Command Attributes, this
+//! makes reuse harder. Generally prefer putting the cmd attributes on the
+//! [`Parser`][crate::Parser] or on the flattened field.
+//! - `subcommand`: Delegates definition of subcommands to the field (must implement
+//! [`Subcommand`][crate::Subcommand])
+//! - When `Option<T>`, the subcommand becomes optional
+//!
+//! ### ArgGroup Attributes
+//!
+//! These correspond to the [`ArgGroup`][crate::ArgGroup] which is implicitly created for each
+//! `Args` derive.
+//!
+//! **Raw attributes:** Any [`ArgGroup` method][crate::ArgGroup] can also be used as an attribute, see [Terminology](#terminology) for syntax.
+//! - e.g. `#[group(required = true)]` would translate to `arg_group.required(true)`
+//!
+//! **Magic attributes**:
+//! - `id = <expr>`: [`ArgGroup::id`][crate::ArgGroup::id]
+//! - When not present: struct's name is used
+//! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`
+//! - Without `<expr>`: fills the field with `Default::default()`
+//!
+//! ### Arg Attributes
+//!
+//! These correspond to a [`Arg`][crate::Arg].
+//!
+//! **Raw attributes:** Any [`Arg` method][crate::Arg] can also be used as an attribute, see [Terminology](#terminology) for syntax.
+//! - e.g. `#[arg(max_values(3))]` would translate to `arg.max_values(3)`
+//!
+//! **Magic attributes**:
+//! - `id = <expr>`: [`Arg::id`][crate::Arg::id]
+//! - When not present: field's name is used
+//! - `value_parser [= <expr>]`: [`Arg::value_parser`][crate::Arg::value_parser]
+//! - When not present: will auto-select an implementation based on the field type using
+//! [`value_parser!`][crate::value_parser!]
+//! - `action [= <expr>]`: [`Arg::action`][crate::Arg::action]
+//! - When not present: will auto-select an action based on the field type
+//! - `help = <expr>`: [`Arg::help`][crate::Arg::help]
+//! - When not present: [Doc comment summary](#doc-comments)
+//! - `long_help[ = <expr>]`: [`Arg::long_help`][crate::Arg::long_help]
+//! - When not present: [Doc comment](#doc-comments) if there is a blank line, else nothing
+//! - When present without a value: [Doc comment](#doc-comments)
+//! - `verbatim_doc_comment`: Minimizes pre-processing when converting doc comments to [`help`][crate::Arg::help] / [`long_help`][crate::Arg::long_help]
+//! - `short [= <char>]`: [`Arg::short`][crate::Arg::short]
+//! - When not present: no short set
+//! - Without `<char>`: defaults to first character in the case-converted field name
+//! - `long [= <str>]`: [`Arg::long`][crate::Arg::long]
+//! - When not present: no long set
+//! - Without `<str>`: defaults to the case-converted field name
+//! - `env [= <str>]`: [`Arg::env`][crate::Arg::env] (needs [`env` feature][crate::_features] enabled)
+//! - When not present: no env set
+//! - Without `<str>`: defaults to the case-converted field name
+//! - `from_global`: Read a [`Arg::global`][crate::Arg::global] argument (raw attribute), regardless of what subcommand you are in
+//! - `value_enum`: Parse the value using the [`ValueEnum`][crate::ValueEnum]
+//! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`
+//! - Without `<expr>`: fills the field with `Default::default()`
+//! - `default_value = <str>`: [`Arg::default_value`][crate::Arg::default_value] and [`Arg::required(false)`][crate::Arg::required]
+//! - `default_value_t [= <expr>]`: [`Arg::default_value`][crate::Arg::default_value] and [`Arg::required(false)`][crate::Arg::required]
+//! - Requires `std::fmt::Display` that roundtrips correctly with the
+//! [`Arg::value_parser`][crate::Arg::value_parser] or `#[arg(value_enum)]`
+//! - Without `<expr>`, relies on `Default::default()`
+//! - `default_values_t = <expr>`: [`Arg::default_values`][crate::Arg::default_values] and [`Arg::required(false)`][crate::Arg::required]
+//! - Requires field arg to be of type `Vec<T>` and `T` to implement `std::fmt::Display` or `#[arg(value_enum)]`
+//! - `<expr>` must implement `IntoIterator<T>`
+//! - `default_value_os_t [= <expr>]`: [`Arg::default_value_os`][crate::Arg::default_value_os] and [`Arg::required(false)`][crate::Arg::required]
+//! - Requires `std::convert::Into<OsString>` or `#[arg(value_enum)]`
+//! - Without `<expr>`, relies on `Default::default()`
+//! - `default_values_os_t = <expr>`: [`Arg::default_values_os`][crate::Arg::default_values_os] and [`Arg::required(false)`][crate::Arg::required]
+//! - Requires field arg to be of type `Vec<T>` and `T` to implement `std::convert::Into<OsString>` or `#[arg(value_enum)]`
+//! - `<expr>` must implement `IntoIterator<T>`
+//!
+//! ### ValueEnum Attributes
+//!
+//! - `rename_all = <string_literal>`: Override default field / variant name case conversion for [`PossibleValue::new`][crate::builder::PossibleValue]
+//! - When not present: `"kebab-case"`
+//! - Available values: `"camelCase"`, `"kebab-case"`, `"PascalCase"`, `"SCREAMING_SNAKE_CASE"`, `"snake_case"`, `"lower"`, `"UPPER"`, `"verbatim"`
+//!
+//! ### Possible Value Attributes
+//!
+//! These correspond to a [`PossibleValue`][crate::builder::PossibleValue].
+//!
+//! **Raw attributes:** Any [`PossibleValue` method][crate::builder::PossibleValue] can also be used as an attribute, see [Terminology](#terminology) for syntax.
+//! - e.g. `#[value(alias("foo"))]` would translate to `pv.alias("foo")`
+//!
+//! **Magic attributes**:
+//! - `name = <expr>`: [`PossibleValue::new`][crate::builder::PossibleValue::new]
+//! - When not present: case-converted field name is used
+//! - `help = <expr>`: [`PossibleValue::help`][crate::builder::PossibleValue::help]
+//! - When not present: [Doc comment summary](#doc-comments)
+//! - `skip`: Ignore this variant
+//!
+//! ## Arg Types
+//!
+//! `clap` assumes some intent based on the type used:
+//!
+//! | Type | Effect | Implies |
+//! |---------------------|--------------------------------------|-------------------------------------------------------------|
+//! | `()` | user-defined | `.action(ArgAction::Set).required(false)` |
+//! | `bool` | flag | `.action(ArgAction::SetTrue)` |
+//! | `Option<T>` | optional argument | `.action(ArgAction::Set).required(false)` |
+//! | `Option<Option<T>>` | optional value for optional argument | `.action(ArgAction::Set).required(false).num_args(0..=1)` |
+//! | `T` | required argument | `.action(ArgAction::Set).required(!has_default)` |
+//! | `Vec<T>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` |
+//! | `Option<Vec<T>>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` |
+//!
+//! In addition, [`.value_parser(value_parser!(T))`][crate::value_parser!] is called for each
+//! field.
+//!
+//! Notes:
+//! - For custom type behavior, you can override the implied attributes/settings and/or set additional ones
+//! - To force any inferred type (like `Vec<T>`) to be treated as `T`, you can refer to the type
+//! by another means, like using `std::vec::Vec` instead of `Vec`. For improving this, see
+//! [#4626](https://github.com/clap-rs/clap/issues/4626).
+//! - `Option<Vec<T>>` will be `None` instead of `vec![]` if no arguments are provided.
+//! - This gives the user some flexibility in designing their argument, like with `num_args(0..)`
+//!
+//! ## Doc Comments
+//!
+//! In clap, help messages for the whole binary can be specified
+//! via [`Command::about`][crate::Command::about] and [`Command::long_about`][crate::Command::long_about] while help messages
+//! for individual arguments can be specified via [`Arg::help`][crate::Arg::help] and [`Arg::long_help`][crate::Arg::long_help].
+//!
+//! `long_*` variants are used when user calls the program with
+//! `--help` and "short" variants are used with `-h` flag.
+//!
+//! ```rust
+//! # use clap::Parser;
+//!
+//! #[derive(Parser)]
+//! #[command(about = "I am a program and I work, just pass `-h`", long_about = None)]
+//! struct Foo {
+//! #[arg(short, help = "Pass `-h` and you'll see me!")]
+//! bar: String,
+//! }
+//! ```
+//!
+//! For convenience, doc comments can be used instead of raw methods
+//! (this example works exactly like the one above):
+//!
+//! ```rust
+//! # use clap::Parser;
+//!
+//! #[derive(Parser)]
+//! /// I am a program and I work, just pass `-h`
+//! struct Foo {
+//! /// Pass `-h` and you'll see me!
+//! bar: String,
+//! }
+//! ```
+//!
+//! **NOTE:** Attributes have priority over doc comments!
+//!
+//! **Top level doc comments always generate `Command::about/long_about` calls!**
+//! If you really want to use the `Command::about/long_about` methods (you likely don't),
+//! use the `about` / `long_about` attributes to override the calls generated from
+//! the doc comment. To clear `long_about`, you can use
+//! `#[command(long_about = None)]`.
+//!
+//! ### Pre-processing
+//!
+//! ```rust
+//! # use clap::Parser;
+//! #[derive(Parser)]
+//! /// Hi there, I'm Robo!
+//! ///
+//! /// I like beeping, stumbling, eating your electricity,
+//! /// and making records of you singing in a shower.
+//! /// Pay up, or I'll upload it to youtube!
+//! struct Robo {
+//! /// Call my brother SkyNet.
+//! ///
+//! /// I am artificial superintelligence. I won't rest
+//! /// until I'll have destroyed humanity. Enjoy your
+//! /// pathetic existence, you mere mortals.
+//! #[arg(long, action)]
+//! kill_all_humans: bool,
+//! }
+//! ```
+//!
+//! A doc comment consists of three parts:
+//! - Short summary
+//! - A blank line (whitespace only)
+//! - Detailed description, all the rest
+//!
+//! The summary corresponds with `Command::about` / `Arg::help`. When a blank line is
+//! present, the whole doc comment will be passed to `Command::long_about` /
+//! `Arg::long_help`. Or in other words, a doc may result in just a `Command::about` /
+//! `Arg::help` or `Command::about` / `Arg::help` and `Command::long_about` /
+//! `Arg::long_help`
+//!
+//! In addition, when `verbatim_doc_comment` is not present, `clap` applies some preprocessing, including:
+//!
+//! - Strip leading and trailing whitespace from every line, if present.
+//!
+//! - Strip leading and trailing blank lines, if present.
+//!
+//! - Interpret each group of non-empty lines as a word-wrapped paragraph.
+//!
+//! We replace newlines within paragraphs with spaces to allow the output
+//! to be re-wrapped to the terminal width.
+//!
+//! - Strip any excess blank lines so that there is exactly one per paragraph break.
+//!
+//! - If the first paragraph ends in exactly one period,
+//! remove the trailing period (i.e. strip trailing periods but not trailing ellipses).
+//!
+//! Sometimes you don't want this preprocessing to apply, for example the comment contains
+//! some ASCII art or markdown tables, you would need to preserve LFs along with
+//! blank lines and the leading/trailing whitespace. When you pass use the
+//! `verbatim_doc_comment` magic attribute, you preserve
+//! them.
+//!
+//! **Note:** Keep in mind that `verbatim_doc_comment` will *still*
+//! - Remove one leading space from each line, even if this attribute is present,
+//! to allow for a space between `///` and the content.
+//! - Remove leading and trailing blank lines
+//!
+//! ## Mixing Builder and Derive APIs
+//!
+//! The builder and derive APIs do not live in isolation. They can work together, which is
+//! especially helpful if some arguments can be specified at compile-time while others must be
+//! specified at runtime.
+//!
+//! ### Using derived arguments in a builder application
+//!
+//! When using the derive API, you can `#[command(flatten)]` a struct deriving `Args` into a struct
+//! deriving `Args` or `Parser`. This example shows how you can augment a `Command` instance
+//! created using the builder API with `Args` created using the derive API.
+//!
+//! It uses the [`Args::augment_args`][crate::Args::augment_args] method to add the arguments to
+//! the `Command` instance.
+//!
+//! Crates such as [clap-verbosity-flag](https://github.com/rust-cli/clap-verbosity-flag) provide
+//! structs that implement `Args`. Without the technique shown in this example, it would not be
+//! possible to use such crates with the builder API.
+//!
+//! For example:
+//! ```rust
+#![doc = include_str!("../../examples/derive_ref/augment_args.rs")]
+//! ```
+//!
+//! ### Using derived subcommands in a builder application
+//!
+//! When using the derive API, you can use `#[command(subcommand)]` inside the struct to add
+//! subcommands. The type of the field is usually an enum that derived `Parser`. However, you can
+//! also add the subcommands in that enum to a `Command` instance created with the builder API.
+//!
+//! It uses the [`Subcommand::augment_subcommands`][crate::Subcommand::augment_subcommands] method
+//! to add the subcommands to the `Command` instance.
+//!
+//! For example:
+//! ```rust
+#![doc = include_str!("../../examples/derive_ref/augment_subcommands.rs")]
+//! ```
+//!
+//! ### Adding hand-implemented subcommands to a derived application
+//!
+//! When using the derive API, you can use `#[command(subcommand)]` inside the struct to add
+//! subcommands. The type of the field is usually an enum that derived `Parser`. However, you can
+//! also implement the `Subcommand` trait manually on this enum (or any other type) and it can
+//! still be used inside the struct created with the derive API. The implementation of the
+//! `Subcommand` trait will use the builder API to add the subcommands to the `Command` instance
+//! created behind the scenes for you by the derive API.
+//!
+//! Notice how in the previous example we used
+//! [`augment_subcommands`][crate::Subcommand::augment_subcommands] on an enum that derived
+//! `Parser`, whereas now we implement
+//! [`augment_subcommands`][crate::Subcommand::augment_subcommands] ourselves, but the derive API
+//! calls it automatically since we used the `#[command(subcommand)]` attribute.
+//!
+//! For example:
+//! ```rust
+#![doc = include_str!("../../examples/derive_ref/hand_subcommand.rs")]
+//! ```
+//!
+//! ### Flattening hand-implemented args into a derived application
+//!
+//! When using the derive API, you can use `#[command(flatten)]` inside the struct to add arguments as
+//! if they were added directly to the containing struct. The type of the field is usually an
+//! struct that derived `Args`. However, you can also implement the `Args` trait manually on this
+//! struct (or any other type) and it can still be used inside the struct created with the derive
+//! API. The implementation of the `Args` trait will use the builder API to add the arguments to
+//! the `Command` instance created behind the scenes for you by the derive API.
+//!
+//! Notice how in the previous example we used [`augment_args`][crate::Args::augment_args] on the
+//! struct that derived `Parser`, whereas now we implement
+//! [`augment_args`][crate::Args::augment_args] ourselves, but the derive API calls it
+//! automatically since we used the `#[command(flatten)]` attribute.
+//!
+//! For example:
+//! ```rust
+#![doc = include_str!("../../examples/derive_ref/flatten_hand_args.rs")]
+//! ```
+//!
+//! ## Tips
+//!
+//! - To get access to a [`Command`][crate::Command] call
+//! [`CommandFactory::command`][crate::CommandFactory::command] (implemented when deriving
+//! [`Parser`][crate::Parser])
+//! - Proactively check for bad [`Command`][crate::Command] configurations by calling
+//! [`Command::debug_assert`][crate::Command::debug_assert] in a test
+//! ([example][_tutorial#testing])
+//! - Always remember to [document](#doc-comments) args and commands with `#![deny(missing_docs)]`
+
+// Point people here that search for attributes that don't exist in the derive (a subset of magic
+// attributes)
+#![doc(alias = "skip")]
+#![doc(alias = "verbatim_doc_comment")]
+#![doc(alias = "flatten")]
+#![doc(alias = "external_subcommand")]
+#![doc(alias = "subcommand")]
+#![doc(alias = "rename_all")]
+#![doc(alias = "rename_all_env")]
+#![doc(alias = "default_value_t")]
+#![doc(alias = "default_values_t")]
+#![doc(alias = "default_value_os_t")]
+#![doc(alias = "default_values_os_t")]
+
+pub mod _tutorial;
+#[doc(inline)]
+pub use crate::_cookbook;
diff --git a/third_party/rust/clap/src/_faq.rs b/third_party/rust/clap/src/_faq.rs
new file mode 100644
index 0000000000..70e7ca5bcc
--- /dev/null
+++ b/third_party/rust/clap/src/_faq.rs
@@ -0,0 +1,95 @@
+//! # Documentation: FAQ
+//!
+//! 1. [Comparisons](#comparisons)
+//! 1. [How does `clap` compare to structopt?](#how-does-clap-compare-to-structopt)
+//! 2. [What are some reasons to use `clap`? (The Pitch)](#what-are-some-reasons-to-use-clap-the-pitch)
+//! 3. [What are some reasons *not* to use `clap`? (The Anti Pitch)](#what-are-some-reasons-not-to-use-clap-the-anti-pitch)
+//! 4. [Reasons to use `clap`](#reasons-to-use-clap)
+//! 2. [How many approaches are there to create a parser?](#how-many-approaches-are-there-to-create-a-parser)
+//! 3. [When should I use the builder vs derive APIs?](#when-should-i-use-the-builder-vs-derive-apis)
+//! 4. [Why is there a default subcommand of help?](#why-is-there-a-default-subcommand-of-help)
+//!
+//! ### Comparisons
+//!
+//! First, let me say that these comparisons are highly subjective, and not meant
+//! in a critical or harsh manner. All the argument parsing libraries out there (to
+//! include `clap`) have their own strengths and weaknesses. Sometimes it just
+//! comes down to personal taste when all other factors are equal. When in doubt,
+//! try them all and pick one that you enjoy :). There's plenty of room in the Rust
+//! community for multiple implementations!
+//!
+//! For less detailed but more broad comparisons, see
+//! [argparse-benchmarks](https://github.com/rust-cli/argparse-benchmarks-rs).
+//!
+//! #### How does `clap` compare to [structopt](https://github.com/TeXitoi/structopt)?
+//!
+//! Simple! `clap` *is* `structopt`. `structopt` started as a derive API built on
+//! top of clap v2. With clap v3, we've forked structopt and integrated it
+//! directly into clap. structopt is in
+//! [maintenance mode](https://github.com/TeXitoi/structopt/issues/516#issuecomment-989566094)
+//! with the release of `clap_derive`.
+//!
+//! The benefits of integrating `structopt` and `clap` are:
+//! - Easier cross-linking in documentation
+//! - [Documentation parity](../examples)
+//! - Tighter design feedback loop, ensuring all new features are designed with
+//! derives in mind and easier to change `clap` in response to `structopt` bugs.
+//! - Clearer endorsement of `structopt`
+//!
+//! See also
+//! - [`clap` v3 CHANGELOG](../CHANGELOG.md#300---2021-12-31)
+//! - [`structopt` migration guide](../CHANGELOG.md#migrate-structopt)
+//!
+//! #### What are some reasons to use `clap`? (The Pitch)
+//!
+//! `clap` is as fast, and as lightweight as possible while still giving all the features you'd expect from a modern argument parser. In fact, for the amount and type of features `clap` offers it remains about as fast as `getopts`. If you use `clap`, when you just need some simple arguments parsed, you'll find it's a walk in the park. `clap` also makes it possible to represent extremely complex and advanced requirements without too much thought. `clap` aims to be intuitive, easy to use, and fully capable for wide variety use cases and needs.
+//!
+//! #### What are some reasons *not* to use `clap`? (The Anti Pitch)
+//!
+//! Depending on the style in which you choose to define the valid arguments, `clap` can be very verbose. `clap` also offers so many finetuning knobs and dials, that learning everything can seem overwhelming. I strive to keep the simple cases simple, but when turning all those custom dials it can get complex. `clap` is also opinionated about parsing. Even though so much can be tweaked and tuned with `clap` (and I'm adding more all the time), there are still certain features which `clap` implements in specific ways that may be contrary to some users' use-cases.
+//!
+//! #### Reasons to use `clap`
+//!
+//! * You want all the nice CLI features your users may expect, yet you don't want to implement them all yourself. You'd like to focus on your application, not argument parsing.
+//! * In addition to the point above, you don't want to sacrifice performance to get all those nice features.
+//! * You have complex requirements/conflicts between your various valid args.
+//! * You want to use subcommands (although other libraries also support subcommands, they are not nearly as feature rich as those provided by `clap`).
+//! * You want some sort of custom validation built into the argument parsing process, instead of as part of your application (which allows for earlier failures, better error messages, more cohesive experience, etc.).
+//!
+//! ### How many approaches are there to create a parser?
+//!
+//! The following APIs are supported:
+//! - [Derive][crate::_derive::_tutorial]
+//! - [Builder][crate::_tutorial]
+//!
+//! Previously, we supported:
+//! - [YAML](https://github.com/clap-rs/clap/issues/3087)
+//! - [docopt](http://docopt.org/)-inspired [usage parser](https://github.com/clap-rs/clap/issues/3086)
+//! - [`clap_app!`](https://github.com/clap-rs/clap/issues/2835)
+//!
+//! There are also experiments with other APIs:
+//! - [fncmd](https://github.com/yuhr/fncmd): function attribute
+//! - [clap-serde](https://github.com/aobatact/clap-serde): create an `Command` from a deserializer
+//!
+//! ### When should I use the builder vs derive APIs?
+//!
+//! Our default answer is to use the [Derive API][crate::_derive::_tutorial]:
+//! - Easier to read, write, and modify
+//! - Easier to keep the argument declaration and reading of argument in sync
+//! - Easier to reuse, e.g. [clap-verbosity-flag](https://crates.io/crates/clap-verbosity-flag)
+//!
+//! The [Builder API][crate::_tutorial] is a lower-level API that someone might want to use for
+//! - Faster compile times if you aren't already using other procedural macros
+//! - More flexibility, e.g. you can look up an [arguments values][crate::ArgMatches::get_many],
+//! their [ordering with other arguments][crate::ArgMatches::indices_of], and [what set
+//! them][crate::ArgMatches::value_source]. The Derive API can only report values and not
+//! indices of or other data.
+//!
+//! You can [interop between Derive and Builder APIs][crate::_derive#mixing-builder-and-derive-apis].
+//!
+//! ### Why is there a default subcommand of help?
+//!
+//! There is only a default subcommand of `help` when other subcommands have been defined manually. So it's opt-in(ish), being that you only get a `help` subcommand if you're actually using subcommands.
+//!
+//! Also, if the user defined a `help` subcommand themselves, the auto-generated one wouldn't be added (meaning it's only generated if the user hasn't defined one themselves).
+//!
diff --git a/third_party/rust/clap/src/_features.rs b/third_party/rust/clap/src/_features.rs
new file mode 100644
index 0000000000..b47ee259c2
--- /dev/null
+++ b/third_party/rust/clap/src/_features.rs
@@ -0,0 +1,28 @@
+//! ## Documentation: Feature Flags
+//!
+//! Available [compile-time feature flags](https://doc.rust-lang.org/cargo/reference/features.html#dependency-features)
+//!
+//! #### Default Features
+//!
+//! * **std**: _Not Currently Used._ Placeholder for supporting `no_std` environments in a backwards compatible manner.
+//! * **color**: Turns on colored error messages.
+//! * **help**: Auto-generate help output
+//! * **usage**: Auto-generate usage
+//! * **error-context**: Include contextual information for errors (which arg failed, etc)
+//! * **suggestions**: Turns on the `Did you mean '--myoption'?` feature for when users make typos.
+//!
+//! #### Optional features
+//!
+//! * **deprecated**: Guided experience to prepare for next breaking release (at different stages of development, this may become default)
+//! * **derive**: Enables the custom derive (i.e. `#[derive(Parser)]`). Without this you must use one of the other methods of creating a `clap` CLI listed above.
+//! * **cargo**: Turns on macros that read values from [`CARGO_*` environment variables](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates).
+//! * **env**: Turns on the usage of environment variables during parsing.
+//! * **unicode**: Turns on support for unicode characters (including emoji) in arguments and help messages.
+//! * **wrap_help**: Turns on the help text wrapping feature, based on the terminal size.
+//! * **string**: Allow runtime generated strings (e.g. with [`Str`][crate::builder::Str]).
+//!
+//! #### Experimental features
+//!
+//! **Warning:** These may contain breaking changes between minor releases.
+//!
+//! * **unstable-v5**: Preview features which will be stable on the v5.0 release
diff --git a/third_party/rust/clap/src/_tutorial/chapter_0.rs b/third_party/rust/clap/src/_tutorial/chapter_0.rs
new file mode 100644
index 0000000000..6999f08b79
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_0.rs
@@ -0,0 +1,24 @@
+//! ## Quick Start
+//!
+//! You can create an application with several arguments using usage strings.
+//!
+//! First, ensure `clap` is available:
+//! ```console
+//! $ cargo add clap
+//! ```
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/01_quick.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/tutorial_builder/01_quick.md")]
+//!
+//! See also
+//! - [FAQ: When should I use the builder vs derive APIs?][crate::_faq#when-should-i-use-the-builder-vs-derive-apis]
+//! - The [cookbook][crate::_cookbook] for more application-focused examples
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_1 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/chapter_1.rs b/third_party/rust/clap/src/_tutorial/chapter_1.rs
new file mode 100644
index 0000000000..fbafaf722c
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_1.rs
@@ -0,0 +1,31 @@
+//! ## Configuring the Parser
+//!
+//! You use [`Command`][crate::Command] to start building a parser.
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/02_apps.rs")]
+//! ```
+//!
+#![doc = include_str!("../../examples/tutorial_builder/02_apps.md")]
+//!
+//! You can use [`command!()`][crate::command!] to fill these fields in from your `Cargo.toml`
+//! file. **This requires the [`cargo` feature flag][crate::_features].**
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/02_crate.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/02_crate.md")]
+//!
+//! You can use [`Command`][crate::Command] methods to change the application level behavior of
+//! clap, like [`Command::next_line_help`].
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/02_app_settings.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/02_app_settings.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_0 as previous;
+pub use super::chapter_2 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/chapter_2.rs b/third_party/rust/clap/src/_tutorial/chapter_2.rs
new file mode 100644
index 0000000000..607b4e4e68
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_2.rs
@@ -0,0 +1,87 @@
+//! ## Adding Arguments
+//!
+//! 1. [Positionals](#positionals)
+//! 2. [Options](#options)
+//! 3. [Flags](#flags)
+//! 4. [Subcommands](#subcommands)
+//! 5. [Defaults](#defaults)
+//!
+//!
+//! ### Positionals
+//!
+//! You can have users specify values by their position on the command-line:
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_03_positional.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_03_positional.md")]
+//!
+//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To
+//! accept multiple values, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append]:
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_03_positional_mult.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_03_positional_mult.md")]
+//!
+//! ### Options
+//!
+//! You can name your arguments with a flag:
+//! - Order doesn't matter
+//! - They can be optional
+//! - Intent is clearer
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_02_option.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_02_option.md")]
+//!
+//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To
+//! accept multiple occurrences, override the [action][Arg::action] with [`Append`][crate::ArgAction::Append]:
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_02_option_mult.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_02_option_mult.md")]
+//!
+//! ### Flags
+//!
+//! Flags can also be switches that can be on/off:
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_01_flag_bool.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_01_flag_bool.md")]
+//!
+//! To accept multiple flags, use [`Count`][crate::ArgAction::Count]:
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_01_flag_count.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_01_flag_count.md")]
+//!
+//! ### Subcommands
+//!
+//! Subcommands are defined as [`Command`][crate::Command]s that get added via
+//! [`Command::subcommand`][crate::Command::subcommand]. Each instance of a Subcommand can have its
+//! own version, author(s), Args, and even its own subcommands.
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_04_subcommands.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_04_subcommands.md")]
+//!
+//! ### Defaults
+//!
+//! We've previously showed that arguments can be [`required`][crate::Arg::required] or optional.
+//! When optional, you work with a `Option` and can `unwrap_or`. Alternatively, you can set
+//! [`Arg::default_value`][crate::Arg::default_value].
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/03_05_default_values.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/03_05_default_values.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_1 as previous;
+pub use super::chapter_3 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/chapter_3.rs b/third_party/rust/clap/src/_tutorial/chapter_3.rs
new file mode 100644
index 0000000000..6dc7db2db7
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_3.rs
@@ -0,0 +1,84 @@
+//! ## Validation
+//!
+//! 1. [Enumerated values](#enumerated-values)
+//! 2. [Validated values](#validated-values)
+//! 3. [Argument Relations](#argument-relations)
+//! 4. [Custom Validation](#custom-validation)
+//!
+//! An appropriate default parser/validator will be selected for the field's type. See
+//! [`value_parser!`][crate::value_parser!] for more details.
+//!
+//! ### Enumerated values
+//!
+//! If you have arguments of specific values you want to test for, you can use the
+//! [`PossibleValuesParser`][crate::builder::PossibleValuesParser] or [`Arg::value_parser(["val1",
+//! ...])`][crate::Arg::value_parser] for short.
+//!
+//! This allows you specify the valid values for that argument. If the user does not use one of
+//! those specific values, they will receive a graceful exit with error message informing them
+//! of the mistake, and what the possible valid values are
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_01_possible.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_01_possible.md")]
+//!
+//! When enabling the [`derive` feature][crate::_features], you can use
+//! [`ValueEnum`][crate::ValueEnum] to take care of the boiler plate for you, giving the same
+//! results.
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_01_enum.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_01_enum.md")]
+//!
+//! ### Validated values
+//!
+//! More generally, you can validate and parse into any data type with [`Arg::value_parser`].
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_02_parse.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_02_parse.md")]
+//!
+//! A [custom parser][TypedValueParser] can be used to improve the error messages or provide additional validation:
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_02_validate.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_02_validate.md")]
+//!
+//! See [`Arg::value_parser`][crate::Arg::value_parser] for more details.
+//!
+//! ### Argument Relations
+//!
+//! You can declare dependencies or conflicts between [`Arg`][crate::Arg]s or even
+//! [`ArgGroup`][crate::ArgGroup]s.
+//!
+//! [`ArgGroup`][crate::ArgGroup]s make it easier to declare relations instead of having to list
+//! each individually, or when you want a rule to apply "any but not all" arguments.
+//!
+//! Perhaps the most common use of [`ArgGroup`][crate::ArgGroup]s is to require one and *only* one
+//! argument to be present out of a given set. Imagine that you had multiple arguments, and you
+//! want one of them to be required, but making all of them required isn't feasible because perhaps
+//! they conflict with each other.
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_03_relations.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_03_relations.md")]
+//!
+//! ### Custom Validation
+//!
+//! As a last resort, you can create custom errors with the basics of clap's formatting.
+//!
+//! ```rust
+#![doc = include_str!("../../examples/tutorial_builder/04_04_custom.rs")]
+//! ```
+#![doc = include_str!("../../examples/tutorial_builder/04_04_custom.md")]
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_2 as previous;
+pub use super::chapter_4 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/chapter_4.rs b/third_party/rust/clap/src/_tutorial/chapter_4.rs
new file mode 100644
index 0000000000..d778fb385e
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_4.rs
@@ -0,0 +1,15 @@
+//! ## Testing
+//!
+//! clap reports most development errors as `debug_assert!`s. Rather than checking every
+//! subcommand, you should have a test that calls
+//! [`Command::debug_assert`][crate::Command::debug_assert]:
+//! ```rust,no_run
+#![doc = include_str!("../../examples/tutorial_builder/05_01_assert.rs")]
+//! ```
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_3 as previous;
+pub use super::chapter_5 as next;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/chapter_5.rs b/third_party/rust/clap/src/_tutorial/chapter_5.rs
new file mode 100644
index 0000000000..a34a91442d
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/chapter_5.rs
@@ -0,0 +1,12 @@
+//! ## Next Steps
+//!
+//! - [Cookbook][crate::_cookbook] for application-focused examples
+//! - Explore more features in the [API reference][super]
+//!
+//! For support, see [Discussions](https://github.com/clap-rs/clap/discussions)
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub use super::chapter_4 as previous;
+pub use crate::_tutorial as table_of_contents;
diff --git a/third_party/rust/clap/src/_tutorial/mod.rs b/third_party/rust/clap/src/_tutorial/mod.rs
new file mode 100644
index 0000000000..16832302db
--- /dev/null
+++ b/third_party/rust/clap/src/_tutorial/mod.rs
@@ -0,0 +1,36 @@
+// Contributing
+//
+// New example code:
+// - Please update the corresponding section in the derive tutorial
+// - Building: They must be added to `Cargo.toml` with the appropriate `required-features`.
+// - Testing: Ensure there is a markdown file with [trycmd](https://docs.rs/trycmd) syntax
+//
+// See also the general CONTRIBUTING
+
+//! # Documentation: Builder Tutorial
+//!
+//! 1. [Quick Start][chapter_0]
+//! 2. [Configuring the Parser][chapter_1]
+//! 3. [Adding Arguments][chapter_2]
+//! 1. [Positionals][chapter_2#positionals]
+//! 2. [Options][chapter_2#options]
+//! 3. [Flags][chapter_2#flags]
+//! 4. [Subcommands][chapter_2#subcommands]
+//! 5. [Defaults][chapter_2#defaults]
+//! 4. [Validation][chapter_3]
+//! 1. [Enumerated values][chapter_3#enumerated-values]
+//! 2. [Validated values][chapter_3#validated-values]
+//! 3. [Argument Relations][chapter_3#argument-relations]
+//! 4. [Custom Validation][chapter_3#custom-validation]
+//! 5. [Testing][chapter_4]
+//! 6. [Next Steps][chapter_5]
+
+#![allow(unused_imports)]
+use crate::builder::*;
+
+pub mod chapter_0;
+pub mod chapter_1;
+pub mod chapter_2;
+pub mod chapter_3;
+pub mod chapter_4;
+pub mod chapter_5;
diff --git a/third_party/rust/clap/src/bin/stdio-fixture.rs b/third_party/rust/clap/src/bin/stdio-fixture.rs
new file mode 100644
index 0000000000..efd6c817bd
--- /dev/null
+++ b/third_party/rust/clap/src/bin/stdio-fixture.rs
@@ -0,0 +1,26 @@
+fn main() {
+ #[allow(unused_mut)]
+ let mut cmd = clap::Command::new("stdio-fixture")
+ .version("1.0")
+ .long_version("1.0 - a2132c")
+ .arg_required_else_help(true)
+ .subcommand(clap::Command::new("more"))
+ .arg(
+ clap::Arg::new("verbose")
+ .long("verbose")
+ .help("log")
+ .action(clap::ArgAction::SetTrue)
+ .long_help("more log"),
+ );
+ #[cfg(feature = "color")]
+ {
+ use clap::builder::styling;
+ let styles = styling::Styles::styled()
+ .header(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
+ .usage(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
+ .literal(styling::AnsiColor::Blue.on_default() | styling::Effects::BOLD)
+ .placeholder(styling::AnsiColor::Cyan.on_default());
+ cmd = cmd.styles(styles);
+ }
+ cmd.get_matches();
+}
diff --git a/third_party/rust/clap/src/lib.rs b/third_party/rust/clap/src/lib.rs
new file mode 100644
index 0000000000..6d0aab09db
--- /dev/null
+++ b/third_party/rust/clap/src/lib.rs
@@ -0,0 +1,113 @@
+// Copyright ⓒ 2015-2016 Kevin B. Knapp and [`clap-rs` contributors](https://github.com/clap-rs/clap/graphs/contributors).
+// Licensed under the MIT license
+// (see LICENSE or <http://opensource.org/licenses/MIT>) All files in the project carrying such
+// notice may not be copied, modified, or distributed except according to those terms.
+
+//! > **Command Line Argument Parser for Rust**
+//!
+//! Quick Links:
+//! - Derive [tutorial][_derive::_tutorial::chapter_0] and [reference][_derive]
+//! - Builder [tutorial][_tutorial::chapter_0] and [reference](index.html)
+//! - [Cookbook][_cookbook]
+//! - [FAQ][_faq]
+//! - [Discussions](https://github.com/clap-rs/clap/discussions)
+//!
+//! ## Aspirations
+//!
+//! - Out of the box, users get a polished CLI experience
+//! - Including common argument behavior, help generation, suggested fixes for users, colored output, [shell completions](https://github.com/clap-rs/clap/tree/master/clap_complete), etc
+//! - Flexible enough to port your existing CLI interface
+//! - However, we won't necessarily streamline support for each use case
+//! - Reasonable parse performance
+//! - Resilient maintainership, including
+//! - Willing to break compatibility rather than batching up breaking changes in large releases
+//! - Leverage feature flags to keep to one active branch
+//! - Being under [WG-CLI](https://github.com/rust-cli/team/) to increase the bus factor
+//! - We follow semver and will wait about 6-9 months between major breaking changes
+//! - We will support the last two minor Rust releases (MSRV, currently 1.70.0)
+//!
+//! While these aspirations can be at odds with fast build times and low binary
+//! size, we will still strive to keep these reasonable for the flexibility you
+//! get. Check out the
+//! [argparse-benchmarks](https://github.com/rust-cli/argparse-benchmarks-rs) for
+//! CLI parsers optimized for other use cases.
+//!
+//! ## Example
+//!
+//! Run
+//! ```console
+//! $ cargo add clap --features derive
+//! ```
+//! *(See also [feature flag reference][_features])*
+//!
+//! Then define your CLI in `main.rs`:
+//! ```rust
+//! # #[cfg(feature = "derive")] {
+#![doc = include_str!("../examples/demo.rs")]
+//! # }
+//! ```
+//!
+//! And try it out:
+#![doc = include_str!("../examples/demo.md")]
+//!
+//! See also the derive [tutorial][_derive::_tutorial] and [reference][_derive]
+//!
+//! ### Related Projects
+//!
+//! Augment clap:
+//! - [wild](https://crates.io/crates/wild) for supporting wildcards (`*`) on Windows like you do Linux
+//! - [argfile](https://crates.io/crates/argfile) for loading additional arguments from a file (aka response files)
+//! - [shadow-rs](https://crates.io/crates/shadow-rs) for generating `Command::long_version`
+//! - [clap_mangen](https://crates.io/crates/clap_mangen) for generating man page source (roff)
+//! - [clap_complete](https://crates.io/crates/clap_complete) for shell completion support
+//!
+//! CLI Helpers
+//! - [cio](https://crates.io/crates/clio) for reading/writing to files specified as arguments
+//! - [clap-verbosity-flag](https://crates.io/crates/clap-verbosity-flag)
+//! - [clap-cargo](https://crates.io/crates/clap-cargo)
+//! - [concolor-clap](https://crates.io/crates/concolor-clap)
+//!
+//! Testing
+//! - [`trycmd`](https://crates.io/crates/trycmd): Bulk snapshot testing
+//! - [`snapbox`](https://crates.io/crates/snapbox): Specialized snapshot testing
+//! - [`assert_cmd`](https://crates.io/crates/assert_cmd) and [`assert_fs`](https://crates.io/crates/assert_fs): Customized testing
+//!
+//! Documentation:
+//! - [Command-line Apps for Rust](https://rust-cli.github.io/book/index.html) book
+//!
+
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+#![doc(html_logo_url = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png")]
+#![warn(
+ missing_docs,
+ missing_debug_implementations,
+ missing_copy_implementations,
+ trivial_casts,
+ unused_allocation,
+ trivial_numeric_casts,
+ clippy::single_char_pattern
+)]
+#![forbid(unsafe_code)]
+// HACK https://github.com/rust-lang/rust-clippy/issues/7290
+#![allow(clippy::single_component_path_imports)]
+#![allow(clippy::branches_sharing_code)]
+// Doesn't allow for debug statements, etc to be unique
+#![allow(clippy::if_same_then_else)]
+// Breaks up parallelism that clarifies intent
+#![allow(clippy::collapsible_else_if)]
+
+pub use clap_builder::*;
+#[cfg(feature = "derive")]
+#[doc(hidden)]
+pub use clap_derive::{self, *};
+
+#[cfg(feature = "unstable-doc")]
+pub mod _cookbook;
+#[cfg(feature = "unstable-doc")]
+pub mod _derive;
+#[cfg(feature = "unstable-doc")]
+pub mod _faq;
+#[cfg(feature = "unstable-doc")]
+pub mod _features;
+#[cfg(feature = "unstable-doc")]
+pub mod _tutorial;