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

Supports multiple renames #313

Merged
merged 6 commits into from
Dec 28, 2016
Merged

Supports multiple renames #313

merged 6 commits into from
Dec 28, 2016

Conversation

babarot
Copy link
Member

@babarot babarot commented Dec 17, 2016

Make the rename-to tag support to multiple renames. Here is an example:

foo/bar
├── README.md
└── bin
    ├── a.sh
    ├── b.sh
    └── c.sh

If you want to load as a command all files ending in sh within the bin directory of that repository:

zplug "foo/bar", as:command, use:"bin/*.sh", rename-to:"*"
$ ls -l ~/.zplug/bin
lrwxr-xr-x 1 b4b4r07 staff  50 Dec 18 01:03 a -> /Users/b4b4r07/.zplug/repos/foo/bar/bin/a.sh
lrwxr-xr-x 1 b4b4r07 staff  54 Dec 18 01:03 b -> /Users/b4b4r07/.zplug/repos/foo/bar/bin/b.sh
lrwxr-xr-x 1 b4b4r07 staff  65 Dec 18 01:03 c -> /Users/b4b4r07/.zplug/repos/foo/bar/bin/c.sh

The above zplug syntax means this in zmv command.

zplug "foo/bar", as:command, use:"bin/(*).sh", rename-to:'$1' # single quotes

It is more convenient to use shorthand notation when executing from the command line. However, in the case of zplug, since it is assumed to write in zshrc file, the latter syntax will be easier to understand than the former notation.

@babarot babarot removed the WIP label Dec 27, 2016
@babarot
Copy link
Member Author

babarot commented Dec 28, 2016

Like zmv command with no options specified, you can now rename a command to load with the string captured with use tag.

zplug 'foo/bar', as:command, use:'(*).sh', rename-to:'$1'

@babarot
Copy link
Member Author

babarot commented Dec 28, 2016

Also,

zplug 'reorx/httpstat', as:command, use:'(httpstat).py', rename-to:'$1'

is acceptable.

Therefore, expand the glob and the capture results even if no wildcards specified.

@zplug-man zplug-man merged commit d0d13d2 into master Dec 28, 2016
@babarot babarot deleted the improve-rename-to branch December 28, 2016 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants