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

Negative integers in the command line #196

Open
mbarbin opened this issue Nov 30, 2024 · 0 comments
Open

Negative integers in the command line #196

mbarbin opened this issue Nov 30, 2024 · 0 comments

Comments

@mbarbin
Copy link

mbarbin commented Nov 30, 2024

Negative integers written with a leading minus sign look like flags in the command line. Example: -1.

I've looked at core.command, climate, and cmdliner and all agree to reject usage of negative integers as positional arguments:

https://github.com/mbarbin/cmdlang/blob/09586616c9256e8335bc56b7593fa00cd425616c/test/expect/test__negative_int_args.ml#L40

However, when the argument is named such as usage like ./main.exe -n -1, these libraries diverge. Some accept this syntax, while cmdliner rejects it:

https://github.com/mbarbin/cmdlang/blob/09586616c9256e8335bc56b7593fa00cd425616c/test/expect/test__negative_int_args.ml#L116

I don't know what to think of this (and don't have a current use case in mind), just reporting this incidental finding in case this is helpful to the cmdliner project. Thanks!

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