Skip to content

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

Merged
sylvestre merged 3 commits intouutils:masterfrom
jhscheer:patch-3
Mar 17, 2021
Merged

rm: add an additional flag -R for --recursive #1834
sylvestre merged 3 commits intouutils:masterfrom
jhscheer:patch-3

Conversation

@jhscheer
Copy link
Copy Markdown
Contributor

make clap support -R in addition to -r

Comment thread src/uu/rm/src/rm.rs
.long(OPT_RECURSIVE)
.help("remove directories and their contents recursively")
)
.arg(
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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