Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect "missing argument at end of command" error #11

Closed
blyxxyz opened this issue Dec 11, 2021 · 1 comment
Closed

Incorrect "missing argument at end of command" error #11

blyxxyz opened this issue Dec 11, 2021 · 1 comment

Comments

@blyxxyz
Copy link
Owner

blyxxyz commented Dec 11, 2021

This code:

fn main() -> Result<(), lexopt::Error> {
    let mut parser = lexopt::Parser::from_env();
    parser.values()?;
    Ok(())
}

Has this behavior:

$ cargo run -- -a b
Error: missing argument at end of command

This is Error::MissingValue's message if Parser doesn't remember an option. In 0.1.0 it was only returned by Parser::value(), at the end of the command line, but Parser::values() may return it if it encounters an option.

An easy fix would be to remove "at end of command" from the message, but maybe there's a better way out.

@blyxxyz
Copy link
Owner Author

blyxxyz commented Feb 5, 2022

A reasonable program would only cause a MissingValue after seeing an option, in which case this version of the message isn't used. So removing "at end of command" doesn't do much harm.

Fixed in 614d714.

@blyxxyz blyxxyz closed this as completed Feb 5, 2022
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

No branches or pull requests

1 participant