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

shell: clink support #1066

Open
rsteube opened this issue Dec 28, 2024 · 2 comments · May be fixed by #1067
Open

shell: clink support #1066

rsteube opened this issue Dec 28, 2024 · 2 comments · May be fixed by #1067
Labels
cmd-clink enhancement New feature or request fund Fundable with polar.sh help wanted Extra attention is needed

Comments

@rsteube
Copy link
Member

rsteube commented Dec 28, 2024

Request

Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities.

Clink offers robust completion configuration utilizing Lua. It is already compatible with Starship. This request is to add carapace support for Clink.

Proposed solution

The documentation for adding completions can be found here. The solution is for either the author of carapace-bin, myself or another contributor to take on the task of adding Clink as a shell for completion support.

Anything else?

  • Usage Hint for usage/errors
  • Word Breaks can be disabled
  • Colors seems similar to zsh
  • Function to provide the dynamic completion (got word, linestate,...)
  • load to invoke carapace
  • builder to return the results (got display, description,...)
  • loop for positionalany

related carapace-sh/carapace-bin#2665

Polar

Fund with Polar
@rsteube rsteube added cmd-clink enhancement New feature or request help wanted Extra attention is needed fund Fundable with polar.sh labels Dec 28, 2024
@rsteube rsteube linked a pull request Dec 28, 2024 that will close this issue
@rsteube
Copy link
Member Author

rsteube commented Dec 29, 2024

Needs the anti-feature autosuggest disabled (otherwise the completion function gets hammered 🙄).

clink set autosuggest.enable false

@rsteube
Copy link
Member Author

rsteube commented Dec 29, 2024

word is empty contrary to documentation 🤔

local function f(word, word_index, line_state, match_builder) 
  print("\n--")                                                                                             Line with spaces only.
  for i = 1,word_index,1 do                                                                                       (trailing-space)
    print("word" .. i .. ": " .. string.format("%q", line_state:getword(i))) 
  end 
  print("line_state: " .. string.format("%q", line_state:getline())) 
  print("word: " .. string.format("%q", word)) 
  print("endword: " .. string.format("%q", line_state:getendword())) 
  print("getword(wordcount): " .. string.format("%q", line_state:getword(line_state:getwordcount()))) 
   
  return true 
end 
 
clink.argmatcher("word"):addarg({ f }):loop(1) 
❯ word one two th
--
word1: "word"
word2: "one"
word3: "two"
word4: ""
line_state: "word one two th"
word: ""
endword: ""
getword(wordcount): ""    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd-clink enhancement New feature or request fund Fundable with polar.sh help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant