Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions share/completion/abduco
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# (C) 2025 unrealapex

# Completion script for abduco

function completion/abduco {

typeset OPTIONS ARGOPT PREFIX
OPTIONS=( #>#
"v; print version information to standard output and exit"
"r; readonly session"
"e; set the key to detach"
"f; force creation of session when there is already terminated session of the same name"
"c; create a new session and attach to it"
"n; create a new session but do not attach to it"
"A; try to connect to an existing session, upon failure create said session and attach to it"
"a; attach to an existing session"
"l; attach with the lowest priority"
) #<#

command -f completion//parseoptions -es
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(-A|-a|-f)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my understanding is correct, session names are specified as the first operand, not as an argument to an option. When completing an operand, $ARGOPT is empty.

Suggested change
(-A|-a|-f)
('')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Session names are only given as arguments to those three arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Every abduco command requires session names given as the first operand unless abduco is given no options or using the -v(print version).

# FIXME: figure out why this isn't completing
complete -P "$PREFIX" -- $(abduco | tail -n+2 | awk '{print $NF}')
;;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the correct way to write this completion?

esac

}

# vim: set ft=sh ts=8 sts=8 sw=8 et: