Skip to content

docs: say that long opts with optional arguments require equals not space#118

Closed
correabuscar wants to merge 2 commits intorust-lang:masterfrom
correabuscar:patch-1
Closed

docs: say that long opts with optional arguments require equals not space#118
correabuscar wants to merge 2 commits intorust-lang:masterfrom
correabuscar:patch-1

Conversation

@correabuscar
Copy link
Copy Markdown

@correabuscar correabuscar commented Jul 6, 2024

maybe the wording here isn't ideal, but this PR is so that "we"(or you) don't forget to address it. Can always change wording later, before merging.

see comment: #104 (comment)

@correabuscar correabuscar force-pushed the patch-1 branch 2 times, most recently from 4b72c76 to 60f3c15 Compare July 6, 2024 11:41
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather wordy. Could you express it in a smaller paragraph(s) followed by examples instead? That also makes sure it is accurate.

(sorry that this crate hasn't really been maintained in a while)

correabuscar added a commit to correabuscar/getopts that referenced this pull request Feb 10, 2026
@tgross35
Copy link
Copy Markdown
Contributor

This is much cleaner, thanks for that. I meant examples that are doctests so we'll get this verified though - would you be able to add them?

@correabuscar
Copy link
Copy Markdown
Author

This is much cleaner, thanks for that. I meant examples that are doctests so we'll get this verified though - would you be able to add them?

Oh, sorry, I misunderstood and this makes your last sentence from before (ie. this That also makes sure it is accurate.) consistent, even though I ignored it at the time automatically without realizing.

I just realized that maybe this PR is not necessarily correct, after seeing this:

getopts/src/lib.rs

Lines 169 to 180 in 4084692

/// Set or clear "long options only" mode.
///
/// In "long options only" mode, short options cannot be clustered
/// together, and long options can be given with either a single
/// "-" or the customary "--". This mode also changes the meaning
/// of "-a=b"; in the ordinary mode this will parse a short option
/// "-a" with argument "=b"; whereas in long-options-only mode the
/// argument will be simply "b".
pub fn long_only(&mut self, long_only: bool) -> &mut Options {
self.long_only = long_only;
self
}

As I don't really have the time needed to ensure consistency here(ie. much consideration required), I vote we scrap this PR. Also I don't know how to do those doctests, not without spending a bunch of hours first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants