-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix issue #3163: uutils: add dir and vdir utils #3405
Conversation
Great work! Just a "small" comment |
src/uu/ls/src/ls.rs
Outdated
.help("Print help information.") | ||
) | ||
// Format arguments | ||
.arg( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please refactor this ? it is a lot of duplicate content :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please refactor this ? it is a lot of duplicate content :)
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more nits
Committed suggestions |
I think you have to add them here too: |
I added them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready.
Could you please also remove vdir and dir from this line?
https:/uutils/coreutils/blob/main/util/build-gnu.sh#L183=
chcon|dir|runcon|vdir)
=> chcon|runcon)
src/uu/ls/src/ls.rs
Outdated
@@ -797,618 +797,713 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { | |||
list(locs, &config) | |||
} | |||
|
|||
/// The entry point for the dir coreutils | |||
pub fn dir_main(args: impl uucore::Args) -> UResult<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for one more comment
I am wondering if this is possible to move this function into dir.rs ?
to avoid ls.rs to be too big
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could but that would mean making a lot of refactoring in ls
to make a lot of functions and structs accessible to dir
and vdir
. Notably the whole quoting style file that is a private ls
module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could move it into uucore however
Done. Ignore what I said before, I forgot that |
Co-authored-by: Sylvestre Ledru <[email protected]>
Co-authored-by: Sylvestre Ledru <[email protected]>
Co-authored-by: Sylvestre Ledru <[email protected]>
Looks great, i will merge if once the CI is green :) |
Well done! |
Fixes issue #3163 by adding the
dir
andvdir
utils.This is done by adding two function to
ls
:dir_main()
andvdir_main()
. Upon launching one of these utilities, they launch the corresponding functions. These function just adddir
andvdir
default arguments and then launchls
normally.For example, in the
vdir_main()
function, we check if the user gave any formatting related argument and if he didn't, we add the-l
argument to the config (asvdir
is a shortcut tols -l -b
). This allows the user to overwritedir
andvdir
default arguments. We then do the same thing for the othervdir
default argument.Since they use the same functions than
ls
I just added tests for the default output and for the output in case an argument is given.