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

--option=value arguments are ignored (equal sign instead of space between long option and value) #1100

Open
paulzzy opened this issue Jul 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@paulzzy
Copy link

paulzzy commented Jul 17, 2024

What happened?

I noticed that Robocop wasn't following the config I specified when I used --argumentfile. See below for a minimal reproducible example.

What command/code did you try to run?

With equal sign:

❯ robocop --argumentfile=/path/to/config . -vv
No config file found or configuration is empty. Using default configuration
...

Without equal sign:

❯ robocop --argumentfile /path/to/config . -vv
Loaded configuration from /path/to/config
...

What is the full error message?

See above: No config file found or configuration is empty. Using default configuration

What did you expect to happen instead?

--option=value and --option value should behave the same. I didn't test options beside --argumentfile but I would assume the same bug is present for any long option. Note that robotidy (and other tools using Python's default argparse config) accepts both --option=value and --option value.

Operating System

No response

Robocop version

5.0.4

@paulzzy paulzzy added the bug Something isn't working label Jul 17, 2024
@paulzzy paulzzy changed the title --option=value arguments (equal sign between long option and value) are silently ignored --option=value arguments are ignored (equal sign instead of space between long option and value) Jul 17, 2024
@bhirsz
Copy link
Member

bhirsz commented Jul 17, 2024

The problem is that Robotidy and Robocop use totally different cli parser (Robocop uses python default library while Robotidy uses click). This difference already lead to some problems in the past or missing features that had to be implemented separetely. I could add support for key=value options to Robocop but it could be additional work for something that could be supported out of the box of we made switch to click. I need to think about it how I want to approach it - maybe it is good time to switch Robocop cli parser engine to something more modern like click.

@paulzzy
Copy link
Author

paulzzy commented Jul 17, 2024

I think another reasonable approach is to just not support the --option=value format (it seems to be a GNU convention and not everyone follows it). But in that case I think (1) it should be documented and (2) a warning/error should be raised when an unexpected argument is encountered.

@bhirsz
Copy link
Member

bhirsz commented Jul 17, 2024

I will also consider it - switching to click or alternative is a lot of work and its bit of separate subject. As for 2) I agree, it shouldnt silently accept unrecognized arguments. Most likely it was parsed as a file path but I need to check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants