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

rm: add an additional flag -R for --recursive #1834

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

jhscheer
Copy link
Contributor

make clap support -R in addition to -r

@@ -128,6 +128,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.long(OPT_RECURSIVE)
.help("remove directories and their contents recursively")
)
.arg(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use the --alias option ?
https://docs.rs/clap/2.33.3/clap/struct.Arg.html#method.alias

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought clap's visible_alias function could be use for this. However, I as far as I can tell it is not possible to mimic GNU's behaviour with alias. The problem is that alias is only for the long flag, i.e. with .visible_alias("R") the user would have to type --R.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, TIL :)

Could you please add a comment to make it explicit in the code? thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sylvestre sylvestre merged commit 6a109a5 into uutils:master Mar 17, 2021
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

Successfully merging this pull request may close these issues.

2 participants