clap/examples/02_apps.rs
Ed Page 7a59dc3da4 Revert "Automatically read license field from Cargo.toml"
This reverts commit 6898fbde33.

PR #2144 added the `license` field but no consumer has been added since
the (like Issue #1768).  Since this is not ready yet, I am pulling it
from the 3.0 release.

So far, our main route for pulling a feature from the release has
been to put it behind a `unstable-*` feature flag and to create a
stablization tracking issue.  I chose to instead remove the feature
because a write-only field with no effect does not provide values for
people to use in as an early access and so doesn't outweight the cost of
the extra documentation noise and code noise it creates.  Additionally,
keeping an `unstable-` feature around when it has such an unknown path
(and time table) to stalbization feels like it violates YAGNI.  I'm
uncertain how much of this feature we can implement and not create a
legal trap for users because the crate's license is insufficient for the
final artifact's license.  I feel our stabliazation process sshould be
about iteration and collecting user feedback which this doesn't line up
with.

When someone is ready to tackle #1768, it will be easy to revert this
commit and pick up the work again.

Fixes #3001
2021-11-12 09:55:37 -06:00

28 lines
1.3 KiB
Rust

use clap::App;
fn main() {
// Apps describe the top level application
//
// You create an App and set various options on that App using the "builder pattern"
//
// The options (version(), author(), about()) aren't mandatory, but recommended. There is
// another option, usage(), which is an exception to the rule. This should only be used when
// the default usage string automatically generated by clap doesn't suffice.
//
// You also set all the valid arguments your App should accept via the arg(), args(), arg()
// and args_from_usage() (as well as subcommands via the subcommand() and subcommands() methods) which
// will be covered later.
//
// Once all options have been set, call one of the .get_matches* family of methods in order to
// start the parsing and find all valid command line arguments that supplied by the user at
// runtime. The name given to new() will be displayed when the version or help flags are used.
App::new("MyApp")
.version("1.0")
.author("Kevin K. <kbknapp@gmail.com>")
.about("Does awesome things")
.get_matches();
// This example doesn't do much, but it *does* give automatic -h, --help, -V, and --version functionality ;)
// Continued program logic goes here...
}