-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ls: add new optional arguments to --classify flag #3041
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
Conversation
The --classify flag in ls now takes an option when argument that may have the values always, auto and none. Modified clap argument to allow an optional parameter and changed the classify flag value parsing logic to account for this change.
|
Looks good! Thanks!
Could you add a test for |
3f48f2e to
36cf09d
Compare
|
Have added a test for the none case for --indicator-style, --ind and --classify with value none |
|
Thank you! |
|
The GNU tests seem to be failing for one of the I suspect its because in ls -F sub > out || fail=1With my change now it tries to use |
|
Okay, apparently that is not the fix. The GNU version works just fine with this command. Probably needs some different way of handling the flag argument with clap I guess. |
|
My bad, seems like it the GNU ls does require an = to separate. Have made the change so hopefully it should pass this time. I did notice once inconsistency though. In the GNU version of ls, the short version of the --classify flag -F does not allow taking a value whereas my implementation allows that. Not sure if there is a flag in clap to change that. Couldn't find it when I looked. Is that okay ? Or do we want to fix that in some way ? |
Nice! I didn't even think of that.
I don't think there is. Other utils work around this by creating a separate flag for the short flag, which is not great, so I'm fine with leaving it like this, but it'd be great if you could explain that inconsistency in a comment in the code. |
|
Just an observation. The original post asks for |
|
Good catch! It should indeed be |
|
My bad, I noticed that difference when implementing but forgot to call it out. I used the GNU docs as my reference - https://www.gnu.org/software/coreutils/manual/html_node/General-output-formatting.html Is there any reason we want it to be |
|
Oh I see. It both works! Here's some GNU output if the option is wrong: The docs are apparently inconsistent. |
|
Ahh, I see. I should have just gone ahead and tested what the actual thing accepted. Should I modify the help information to also mention these additional values when I add them or should I let it be as it is ? |
|
I think you can leave it like this, clap will also show all possible values and otherwise it will become a bit cluttered I think |
…fy flag Added the other values for the --classify flag along with modifications to tests. Also documented the inconsistency between GNU coreutils because we accept the flag value even for the short version of the flag.
|
Done ! :) |
|
Seems like the windows build failed - But I doubt it is due to my change ? |
|
Yeah, it's probably unrelated |
|
Do we need to rerun that check so that it passes and PR can be reviews/merged ? Or is it a non-random failure that needs to be fixed in the pipeline elsewhere ? |
|
Looks all good! Thanks! |
This PR addresses #2927 .
The --classify flag in ls now takes an option when argument that may have the values always, auto and none.
I modified the help text as best as I could but not sure if it is as expected. Also I couldn't find too many tests for the existing indicator flags so modified an existing test. But this doesn't cover all the cases. Let me know if you'd like me to add more tests.