Forums: ヘルプ (Thread #41345)

completion for tmux (2019-10-23 21:27 by nereusx #83733)

Hello, I am new yash user. I like it so much that I did it login shell.
IMHO Thompson's syntax sucks, so I used tcsh for decades.
All known shell implementations with exception rc/es are sucks too, but yash at least is pretty well written. Nice job guys.

I am try to build completion for tmux. The documentation of 'complete' it is not so good yet.
So, I read a few scripts of /usr/share/yash/completion, to figure out how to do it.

This is what I succeed to do, it is not the best solution but do the basic job.
Could you help?
---
function completion/tmux {
typeset words option desc i IFS='
'
while read -A words; do
desc=${words[2,-1]}
for option in "${words[1,1]%,}"; do
complete -D "$desc" -- "${option}"
done
done <("${WORDS[1]}" list-commands 2>&1)
}
---

Thank you :)
(Last Update: 2019-10-23 21:33 by nereusx)

Reply to #83733×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login