Skip to content

Commit f79fc64

Browse files
committed
Update outdated top level documentation
Rewrite the usage introduction to mention only builder-like methods that add option config when creating instance of Options struct. Passing vector of components is not supported now and the working may cause confusion. Add mention of the double-dash '--' argument and how it works to the overview of option handling
1 parent a1bc6a8 commit f79fc64

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/lib.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@
1212

1313
//! Simple getopt alternative.
1414
//!
15-
//! Construct a vector of options, either by using `reqopt`, `optopt`, and
16-
//! `optflag` or by building them from components yourself, and pass them to
17-
//! `getopts`, along with a vector of actual arguments (not including
18-
//! `argv[0]`). You'll either get a failure code back, or a match. You'll have
19-
//! to verify whether the amount of 'free' arguments in the match is what you
20-
//! expect. Use `opt_*` accessors to get argument values out of the matches
21-
//! object.
15+
//! Construct instance of `Options` and configure it by using `reqopt()`,
16+
//! `optopt()` and other methods that add option configuration. Then call
17+
//! `parse()` method and pass into it a vector of actual arguments (not
18+
//! including `argv[0]`).
19+
//!
20+
//! You'll either get a failure code back, or a match. You'll have to verify
21+
//! whether the amount of 'free' arguments in the match is what you expect. Use
22+
//! `opt_*` accessors to get argument values out of the matches object.
2223
//!
2324
//! Single-character options are expected to appear on the command line with a
2425
//! single preceding dash; multiple-character options are expected to be
2526
//! proceeded by two dashes. Options that expect an argument accept their
2627
//! argument following either a space or an equals sign. Single-character
27-
//! options don't require the space.
28+
//! options don't require the space. Everything after double-dash "--" argument
29+
//! is considered to be a 'free' argument, even if it starts with dash.
2830
//!
2931
//! # Usage
3032
//!

0 commit comments

Comments
 (0)