rossmacarthur / sheldon

:bowtie: Fast, configurable, shell plugin manager
https://sheldon.cli.rs
Apache License 2.0
960 stars 21 forks source link

Rename remote file #125

Closed ThibaultNocchi closed 2 years ago

ThibaultNocchi commented 2 years ago

Hello, thanks for your tool!

I'm downloading a ZSH completion file with the remote plugin, but it seems to need to be renamed to be applied by OMZ.

Is it possible to do this?

Thanks!

rossmacarthur commented 2 years ago

You can apply an arbitrary template to symlink the downloaded file to a folder that Oh My Zsh will load the completion from. For example assuming $ZSH is your Oh My Zsh installation and $ZSH/completions exists:

[templates]
symlink = { value = 'ln -s "{{ file }}" "$ZSH/completions/_{{ name }}"', each = true }

[plugins.myplugin]
remote = "https://myplugin.example.com/file"
apply = ["symlink"]
ThibaultNocchi commented 2 years ago

Thanks, in the end I did this:

[templates]
completion = { value = 'mkdir -p "$ZSH/completions"; ln -s "{{ file }}" "$ZSH/completions/_{{ name }}"', each = true }

Though I think it'd be cool to be able to do something like this:

[plugins.pass]
remote = 'https://git.zx2c4.com/password-store/plain/src/completion/pass.zsh-completion'
name = "_pass"
apply = ["fpath"]

Or I could just link to the file in the same dir with a template, but I didn't find how.

Thanks!