Skip to content

Commit 4b72c76

Browse files
committed
docs: clarify single-char and multi-char options
with tiny examples see comment: #104 (comment)
1 parent 8e64f97 commit 4b72c76

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/lib.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@
2222
//! `opt_*` accessors to get argument values out of the matches object.
2323
//!
2424
//! Single-character options are expected to appear on the command line with a
25-
//! single preceding dash; multiple-character options are expected to be
26-
//! proceeded by two dashes. Options that expect an argument accept their
27-
//! argument following either a space or an equals sign. Single-character
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.
25+
//! single preceding dash eg. `-u`; multiple-character options are expected to be
26+
//! proceeded by two dashes eg. `--unified`.
27+
//! Multiple-character options that have a required argument accept such an
28+
//! argument following either a space or an equals sign eg. `--unified=102`
29+
//! or `--unified 102`, but those multi-character options that have an optional
30+
//! argument only accept such an argument following an equals sign
31+
//! eg. `--unified=103`, otherwise using `--unified 104` will consider `104` as
32+
//! being a `free` argument.
33+
//! Single-character options don't require a space eg. `-u19` but can have one
34+
//! even for optional arguments eg. `-u 20`, however they can't accept an
35+
//! equals sign because eg. `-u=20` will consider `=20` (with the `=` prefix
36+
//! included) to be the expected argument instead of just the `20`.
37+
//! Everything after double-dash "--" argument is considered to be a 'free'
38+
//! argument, even if it starts with dash.
3039
//!
3140
//! # Usage
3241
//!

0 commit comments

Comments
 (0)