-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
pr: add -e/--expand-tabs option parsing #10146
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
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging this PR will degrade performance by 3.09%Comparing Summary
Performance Changes
Footnotes
|
|
I was trying to tackle this problem with a friend too and we encountered problems with clap trying to parse the -e flag. After a while we came up with a similar approach with you but found out that clap has some major problems for this kind of flag. I tested your solution too and you have the same errors. If you run It will consider 'testfile' being an argument for the -e flag. This is obviously not intended. I looked for a while in the clap library and did not encounter a way to enforce clap not allowing the argument for the short -e flag to be seperated by a space. edit |
|
I see, yea this will be bigger than I thought. In this utility and in others we do preparsing of the arguments before passing it to clap so probably in here somewhere we will have to add custom logic to match all of the -e parsing rules: |
|
Yes this might be a bigger problem indeed. Even trying to parse the free_args in the option builder doesn't seem to fix all the problems as it will throw errors if -e is not declared as an arg to the command builder. Having looked through the Command builder docu it doesnt have the option to disable parameters to be "free" as a next argument seperated by a space. The parsing of the numbers is somewhat more trivial and manageable (and i think i solved it on my fork) but im not sure how to approach the space problem. |
|
You are right you can fix it in that Part of the code you referenced. I dont wan't to steal your PR so feel free to reference my branch https://github.com/cerdelen/coreutils/tree/pr_e_flag |
|
No worries, do you want to make a PR? I have a bunch of other ones I need to follow up on, that approach you have seems to work if you can go ahead and make it? One thing I was thinking of was adding a: Since we're going to have to do this for a few different args and it can be referenced like: |
|
I would follow this up and also implement the actual behaviour of the expand tabs flag. Until now i only have a somewhat naive PoW which would still need to have proper variable names etc since for now i just copied the rest of the regex and changed everything to -e. Anyways i will gladly take this up and continue working on this. |
The option for adding -e and --expand-tabs was not added to PR and we have a bunch of failed exit code mismatch errors in the GNU tests for this option. There are many issues outstanding with the implementation of the PR utility and I was hoping to start with the parsing of all of the missing options and once that's added to work away at fixing all of the issues in the implementation.
This also includes the option alias of column for columns.
I added all of the possible option combinations for -e to make sure that it is not failing.