Add path basename --no-extension#10521
Conversation
This makes `path basename` a more useful replacement for the stock `basename`
command, which can be used with `-s .ext` to trim `.ext` from the base name.
Previously, this would have required the equivalent of
path change-extension "" (path basename $path)
but now it can be just
path basename -E $path
|
LGTM. A more general solution would be a |
|
Only question I had was the short flag. I used the capitalized E in the sense that some utils use a capitalized version of a short flag to indicate the opposite (so no Extension). Other options were lowercase e, x, or something else. Another thought is that in the future it might make sense to add Also if the long flag should be --no-ext or if that's something we should silently support but not advertise. |
-E seems fine to me. We don't currently have either
So
Because of our getopt, this would currently allow
I don't believe I've ever needed the specific behavior of And if I did I'd either match all .xyz files and work on them, or I'd use string to remove the .xyz extension specifically. |
|
The only reason for |
Add
path basename --no-extensionThis makes
path basenamea more useful replacement for the stockbasenamecommand, which can be used with
-s .extto trim.extfrom the base name.Previously, this would have required the equivalent of
but now it can be just
TODOs: