Skip to content

Adding path extension command #14144

@kaathewisegit

Description

@kaathewisegit

Related problem

Updating extensions in Nushell is a bit cumbersome right now. Bash has their regex: ${f%.ext}.pdf, which is ugly, but short.

Describe the solution you'd like

A function to update extensions. Given that it can be implemented using existing path functions, I think it can go into the standard library.

# maybe a flag for not updating if a file has no extension
def "path extension" [ext: string] {
     path parse | update extension $ext | path join
}

Describe alternatives you've considered

No response

Additional context and details

Keeping it as an issue due to the parsing slowness (#13152). I'm not sure if it has been fixed or not

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions