chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.7k stars 145 forks source link

[Feature Request] clink installscripts only for certain clinks #200

Closed Roze061 closed 3 years ago

Roze061 commented 3 years ago

Hello, it would be nice if clink installscripts wrote in the clink profile running it

clink --version
1.2.45.472728

ver

Microsoft Windows [Version 10.0.19043.1348]
chrisant996 commented 3 years ago

The purpose of clink installscripts is so that installers of script libraries can install them for all clink profiles.

Instead, when specifying a --profile to use, try also setting the %CLINK_PATH% environment variable to specify paths from which to load scripts for that profile.

I don't want to turn clink installscripts into a super complicated thing that's hard to specify, hard to report on the current settings, and hard to manage.

Roze061 commented 3 years ago

can you add an optional parameter to only install on certain clinks. I want clink not to write to the registry but to the clink profile.

hi chris can you update examples/ex_fzf.lua from issues 89 . there are version restrictions for io.popenrw and there are more lua functions

chrisant996 commented 3 years ago

can you add an optional parameter to only install on certain clinks.

clink installscripts is for use by installer scripts, and installer scripts don't know about different profiles.

I want clink not to write to the registry but to the clink profile.

The whole point of clink installscripts is to write to the registry. So you need to use something else.

hi chris can you update examples/ex_fzf.lua from issues 89 . there are version restrictions for io.popenrw and there are more lua functions

Update it in what way? What version restrictions are you running into? What do you mean by "there are more lua functions"?

The file at examples/ex_fzf.lua is meant to illustrate how to write Lua code that filters matches. It is not meant to be a script that you actually use. I would rather make it more generic and not even mention fzf at all, rather than turn it into some kind of full featured script that gets updated regularly.

Maybe instead you would be interested in the fzf script that @rashil2000 wrote, which is mentioned here.

Roze061 commented 3 years ago

The file at examples/ex_fzf.lua is meant to illustrate how to write Lua code that filters matches. It is not meant to be a script that you actually use. I would rather make it more generic and not even mention fzf at all, rather than turn it into some kind of full featured script that gets updated regularly.

I apologize for asking for an update for the sample script

What version restrictions are you running into? What do you mean by "there are more lua functions"?

I mean this

if not io.popenrw then
    print("fzf.lua requires a newer version of Clink; please upgrade.")
    return
end

This version of fzf.lua works with Clink v1.1.42 and has three commands:

  • luafunc:fzf_file
  • luafunc:fzf_history
  • luafunc:fzf_complete

I'm sorry, don't think about it

yes i also use clink set, but i also use scoop to update and install clink lua scripts now i know the equation might be like scoop adding a powershell module Btw I don't want there to be more in the software registry keys, so I'm not going to use it

chrisant996 commented 3 years ago

I mean this

if not io.popenrw then
    print("fzf.lua requires a newer version of Clink; please upgrade.")
    return
end

No versions of the script work on Clink v1.1.40 or lower. All versions require at least v1.1.41.

Is the request to add a version check into the example script? If so, why?

What I will do is work on finishing the version info annotations in the Lua Reference section of the Clink documentation. Some weeks ago I annotated every function with the version number where it became available. However, I haven't yet chosen how to format that information in the Clink documentation, so it's not listed yet.

  • luafunc:fzf_file
  • luafunc:fzf_history
  • luafunc:fzf_complete

I think the request is less about updating the example, and more about finding a good way to share a fully functional fzf script, right?

That gets into the topic of how to make a library of scripts that people can choose to download. I don't want to take on responsibility for curating or managing a repository of other peoples' scripts. The best recommendation I can give at the moment is for script authors to make their own repos for their scripts, like how I made clink-flex-prompt for that set of scripts.

I guess no one is stepping up to do so for an fzf script, so I guess I can go ahead and make a repo for that one, and I can add a link to it in the Sample Scripts section of the Clink documentation. And also choose a better name for that section than "Sample Scripts". 🙃

chrisant996 commented 3 years ago

Enhanced FZF script is available here: https://github.com/chrisant996/clink-fzf

chrisant996 commented 2 years ago

I've made a clink-gizmos repo with the best Clink scripts that I use.

It does not include [clink-completions](https://github.com/vladimir-kotikov/clink-completions] or clink-flex-prompt at this time. I will likely see about including the former, but the latter probably does not belong there (imagine if other prompt scripts were to be added -- they would be unlikely to coexist well).

This is not quite the same as a universal library of third party scripts, but it is at least a step in a useful direction.