add info about minimum Clink version

This commit is contained in:
Rashil Gandhi 2021-11-26 16:25:06 +05:30
parent 9741d4d0aa
commit 9dc5152086
No known key found for this signature in database
GPG Key ID: 0AF22EDF6BE85BBD
4 changed files with 13 additions and 10 deletions

View File

@ -273,7 +273,7 @@ shown below. Can't see yours? Have a look at the [extra platform instructions](h
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua

View File

@ -161,7 +161,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
#### Cmd
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory:
```lua
-- starship.lua

View File

@ -347,7 +347,7 @@ print_install() {
Typically the path is ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 or ~/.config/powershell/Microsoft.PowerShell_profile.ps1 on -Nix." \
"Invoke-Expression (&starship init powershell)"
printf " %s\n You need to use Clink with Cmd. Add the following to a file %s and place this file in Clink scripts directory:\n\n\t%s\n\n" \
printf " %s\n You need to use Clink (v1.2.30+) with Cmd. Add the following to a file %s and place this file in Clink scripts directory:\n\n\t%s\n\n" \
"${BOLD}${UNDERLINE}Cmd${NO_COLOR}" \
"${BOLD}starship.lua${NO_COLOR}" \
"load(io.popen('starship init cmd'):read(\"*a\"))()"

View File

@ -1,4 +1,8 @@
local custom_prompt = clink.promptfilter(5)
if (clink.version_encoded or 0) < 10020030 then
error("Starship requires a newer version of Clink; please upgrade to Clink v1.2.30 or later.")
end
local starship_prompt = clink.promptfilter(5)
start_time = os.clock()
end_time = 0
@ -24,7 +28,7 @@ clink.onendedit(function (curr_line)
end
end)
function custom_prompt:filter(prompt)
function starship_prompt:filter(prompt)
if starship_preprompt_user_func ~= nil then
starship_preprompt_user_func(prompt)
end
@ -36,7 +40,7 @@ function custom_prompt:filter(prompt)
):read("*a")
end
function custom_prompt:rightfilter(prompt)
function starship_prompt:rightfilter(prompt)
return io.popen("::STARSHIP:: prompt --right"
.." --status="..os.geterrorlevel()
.." --cmd-duration="..math.floor(curr_duration*1000)
@ -45,13 +49,12 @@ function custom_prompt:rightfilter(prompt)
):read("*a")
end
local characterSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
local characterset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
local randomkey = ""
math.randomseed(os.time())
for i = 1, 16 do
local rand = math.random(#characterSet)
randomkey = randomkey..string.sub(characterSet, rand, rand)
local rand = math.random(#characterset)
randomkey = randomkey..string.sub(characterset, rand, rand)
end
os.setenv('STARSHIP_SHELL', 'cmd')