Skip to content

Allow for argument completion - #309

Merged
psviderski merged 14 commits into
psviderski:mainfrom
miekg:miek/26/apr10vr/comp
Apr 29, 2026
Merged

psviderski merged 14 commits into
psviderski:mainfrom
miekg:miek/26/apr10vr/comp

Conversation

@miekg

@miekg miekg commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

This adds completion for cluster interaction for Volumes, Services and Machines. It further uses the machine completion for the -m flag in all commands that have one.

Specifically excluded are local completion for the config file or compose file, ie uc build or uc deploy, but this can be easily added if we wish.

uc ctx use ... added too.
uc deploy/build compose service completion added too

See: #307

This shows for a single command on how to complete service names in the
cluster: `uc inspect <TAB>` will complete using ListServices

See: psviderski#307

Signed-off-by: Miek Gieben <[email protected]>
@psviderski

Copy link
Copy Markdown
Owner

Just before I look into the code, service listing is quite an expensive operation (not optimised) which can take a second or several seconds for setups with a dozens of containers and when the machines are located far from the client (additional latency). How does this feel in practice?
And also, how does the interactive progress ClusterConnect prints work with the completion? Is its stdout just ignored? You can test my prepending an ssh connection to the connections list in the config with some random unreachable IP so that ClusterConnect will fail on it and then try the next one.

@miekg

miekg commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

How does this feel in practice?

If tested it with a cluster with one server and 1 service. Machine itself is US (i'm EU), this worked fine. And my shell (zsh) tells me it's completing and I can interrupt it.
(tbf making this faster is orthogonal to having completion work)

Is its stdout just ignored?

Yes, at least that's what is happening, because I see no output what so ever during the completion.

I'll try to find some time to test this somewhat more intensive

miekg added 5 commits April 22, 2026 09:40
This shows for a single command on how to complete service names in the
cluster: `uc inspect <TAB>` will complete using ListServices

See: psviderski#307

Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
Signed-off-by: Miek Gieben <[email protected]>
@miekg
miekg force-pushed the miek/26/apr10vr/comp branch from 88d5e2b to 325c435 Compare April 22, 2026 07:43
@miekg

miekg commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author
Screencast.From.2026-04-22.09-47-45.mp4

@psviderski psviderski left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks great!
What do you think of moving the internal/completion package to internal/cli/completion as this is scoped to CLI only?

Comment thread internal/cli/completion/context.go
@miekg

miekg commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

moved the import path

Signed-off-by: Miek Gieben <[email protected]>
@psviderski
psviderski merged commit 4a12217 into psviderski:main Apr 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants