Skip to content

completions: add rename#10136

Merged
faho merged 2 commits into
fish-shell:masterfrom
zgracem:completions-rename
Dec 10, 2023
Merged

completions: add rename#10136
faho merged 2 commits into
fish-shell:masterfrom
zgracem:completions-rename

Conversation

@zgracem
Copy link
Copy Markdown
Contributor

@zgracem zgracem commented Dec 5, 2023

Description

Adds completions for rename, rename, and rename.

TODOs:

  • [N/A] Changes to fish usage are reflected in user documentation/manpages.
  • [N/A] Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

@faho
Copy link
Copy Markdown
Member

faho commented Dec 10, 2023

rename is unfortunately an overloaded name - there's one in util-linux with completely different options.

There is also one that the arch package calls "perl-rename". I can't find yours packaged for my system.

This would unfortunately require parsing the rename --version output, see e.g.

if ls --version >/dev/null 2>/dev/null
- except you need to see if it contains util-linux.

@zgracem
Copy link
Copy Markdown
Contributor Author

zgracem commented Dec 10, 2023

The rename on my Mac is the one Homebrew installs, which is a Perl rename:

> brew info rename
==> rename: stable 1.601 (bottled), HEAD
Perl-powered file rename script with many helpful built-ins
http://plasmasturm.org/code/rename

It turns out I have access to a system with the util-linux version too, so I can edit this to make it account for both.

@zgracem
Copy link
Copy Markdown
Contributor Author

zgracem commented Dec 10, 2023

I found a third version (from sudo apt install rename on Ubuntu) which is probably the real perl-rename, since it comes with Perl libraries.

me@sapphire ~ > rename --version
rename from util-linux 2.23.2

me@amethyst ~ > rename --version
/usr/bin/rename using File::Rename version 1.30, File::Rename::Options version 1.10

me@imac ~ > rename --version
# ...exits w/ status 2, prints usage info to stderr...

This PR now accounts for all three.

@faho faho added this to the fish 3.7.0 milestone Dec 10, 2023
@faho faho merged commit 00ffc39 into fish-shell:master Dec 10, 2023
@faho
Copy link
Copy Markdown
Member

faho commented Dec 10, 2023

Nice work, merged!

@zgracem zgracem deleted the completions-rename branch December 10, 2023 21:25
shouya pushed a commit to shouya/fish-shell that referenced this pull request Dec 29, 2023
* completions: add rename

* add completions for other versions of `rename`
zanchey pushed a commit that referenced this pull request Dec 31, 2023
* completions: add rename

* add completions for other versions of `rename`

(cherry picked from commit 00ffc39)
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants