-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Automated validation of command options per platform #1953
Comments
Thanks for raising the issue. It has been discussed previously. Please look at my comment here -#1423 (comment). It would be ideal to have it working for all commands. But I think that's just practically impossible. And even getting it to work for a handful of commands is going to be more work than just manually verifying all the commands, IMO. If someone is willing to take it up, that would be most welcome though. 😄 |
I was thinking more of simple validation against the platform man pages. That is after all how I check and confirm the correct options when I encounter this issue. Anyway, regardless of how they are verified, it remains that they do need to be. |
Is there an API or something through which man page options can be retrieved in a consumable format ? |
Well you can do it easily on the command line?
this took me a couple of minutes to arrive at.
results:
|
Another thought would be to run each command with
results:
|
A bit hackish for my taste. But certainly better than nothing. Anyone welcome to take a stab at this. |
Using
As @agnivade says, it would be nicer if we could leverage some cleaner (machine-readable) input, rather than text-processing free-form content, but if it works well, the benefits would be definitely worth it. Right now we have a single test configuration, but it's certainly possible to setup the Travis build to run in multiple OSes and test the command options depending on the folder of the command in question. |
case in point, your modified command does not work on macOS because grep is different (I used egrep so it would work for everybody). let me think on it some more, as well as your query in my old PR/issue. |
Good point. I swapped to How about |
it was probably the {5} leading spaces (specific to find and macOS, no doubt)
gives me this, incomplete list
this modified version captures them all plus a couple of false positives
results
|
this grabs all bar two types on macOS:
sadly i've no more time right now to get improve it
|
Ah, that makes sense. Using
That's ok (this is all volunteer work after all). We already made some progress here, and anyone who decides to tackle this later on has a head start to base their work on. Cheers! 👍 |
Sounds like everyone's have a bunch of issue with cross-compatibility. Here's my solution that uses man $command_name | awk 'BEGIN { RS=" " } /^\[?-{1,2}/ { gsub(/([\)\[\]]|\s+|[\.,;'"'"']\s*$)/, "", $0); if(length($0) > 0) { print $0; } }' | sort | uniq I could have implemented the |
I'm using tldr less and less because I'm on macOS X and most times I use it I find out the hard way that the arguments are different on macOS X, and I imagine the other supported platforms.
In the past I've filed an update, but that was a very painful process: #1764
I just hit it again for
find
So I'm recommending that you do an (automated?) audit of
common
against all the supported platforms. Without this sort of audit, there is too much friction and misinformation using tldr.The text was updated successfully, but these errors were encountered: