mridgers / clink

Bash's powerful command line editing in cmd.exe
mridgers.github.io/clink
GNU General Public License v3.0
3.15k stars 286 forks source link

Please guide how to start using clink in the .lua file #545

Open dev-mustache opened 3 years ago

dev-mustache commented 3 years ago

Dear all.

I would like to use clink for my prompt customization, but I really have no ideas where to start to use clink within the lua files

I have installed both lua, clink

lua -v # 5.3.5
clink -h # 0.4.9

I have a very lua file as shown below

script.lua

print(clink)
print(clink.get_env('CMDER_ROOT'))

I tried to execute the script.lua using lua script.lua, then I got the result as shown below

Result

nil
C:\Users\John\scoop\apps\lua\current\lua.exe: script.lua:2: attempt to index a nil value (global 'clink')
stack traceback:
        script.lua:2: in main chunk
        [C]: in ?

I also tried using clink inject && lua script.lua but the result was nothing at all, no errors

Please guide how to use clink from within the lua file, thanks.

chrisant996 commented 3 years ago

I recommend starting with Extending Clink, and reading the rest of the Clink documentation.

Also, this repo has been abandoned for a few years. A fork has become the new de facto official repo: chrisant996/clink.