unplugged-vendor/external/rust/crates/structopt/examples
2025-10-06 13:59:42 +00:00
..
after_help.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
at_least_two.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
basic.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
deny_missing_docs.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
doc_comments.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
enum_in_args.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
enum_tuple.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
env.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
example.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
flatten.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
gen_completions.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
git.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
group.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
keyvalue.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
negative_flag.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
no_version.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
README.md Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
rename_all.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
required_if.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
skip.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
subcommand_aliases.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00
true_or_false.rs Initial commit: AOSP 12 vendor with modifications for Unplugged OS 2025-10-06 13:59:42 +00:00

Collection of examples "how to use structopt"

Help on the bottom

How to append a postscript to the help message generated.

At least N

How to require presence of at least N values, like val1 val2 ... valN ... valM.

Basic

A basic example how to use structopt.

Deny missing docs

This is not an example but a test, it should be moved to tests folder as soon as this is fixed (if ever).

Doc comments

How to use doc comments in place of help/long_help.

Enums as arguments

How to use arg_enum! with StructOpt.

Arguments of subcommands in separate struct

How to extract subcommands' args into external structs.

Environment variables

How to use environment variable fallback an how it interacts with default_value.

Advanced

Somewhat complex example of usage of structopt.

Flatten

How to use #[structopt(flatten)]

bash completions

Generating bash completions with structopt.

Git

Pseudo-git example, shows how to use subcommands and how to document them.

Groups

Using clap::Arg::group with structopt.

key=value pairs

How to parse key=value pairs.

--no-* flags

How to add no-thing flag which is true by default and false if passed.

No version

How to completely remove version.

Rename all

How #[structopt(rename_all)] works.

Required If

How to use #[structopt(required_if)].

Skip

How to use #[structopt(skip)].

Aliases

How to use aliases

true or false

How to express ""true" or "false" argument.