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

Bash completion errors for invalid subcommands #975

Closed
oturpe opened this issue Jan 8, 2022 · 4 comments · Fixed by #840
Closed

Bash completion errors for invalid subcommands #975

oturpe opened this issue Jan 8, 2022 · 4 comments · Fixed by #840
Labels
1. Bug Something isn't working
Milestone

Comments

@oturpe
Copy link
Contributor

oturpe commented Jan 8, 2022

Describe the bug
I was trying to remove a container I do not need any more.
The name of the container was rawhide-test,
so I typed: $ toolbox remove raw
and tried to save me some typing by invoking bash completion with <Tab>.
The following error was printed:

bash: options: bad array subscript

This happens because remove is not a Toolbox subcommand,
the correct command is rm,
In which case bash completion works as expected.
But, every other tool's bash completion simply does not complete or suggest anything
when there are no completions available.

Steps how to reproduce the behaviour
1.Type, but do not hit enter: $ toolbox invalid-command
2. Invoke bash completion by hitting <Tab>

Expected behaviour
Nothing happens.

Actual behaviour
Error as given in the description appears.

Screenshots
n/a

Output of toolbox --version (v0.0.90+)
toolbox version 0.0.99.2

Toolbox package info (rpm -q toolbox)
toolbox-0.0.99.2^3.git075b9a8d2779-4.fc35.x86_64

Output of podman version

Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.16.8
Built:        Wed Dec  8 23:45:07 2021
OS/Arch:      linux/amd64

Podman package info (rpm -q podman)
podman-3.4.4-1.fc35.x86_64

Info about your OS
Fedora Workstation 35

Additional context
n/a

@oturpe oturpe added the 1. Bug Something isn't working label Jan 8, 2022
@HarryMichal
Copy link
Member

Thank you for the report, @oturpe! I can reproduce it on my machine, too. I believe #840 should fix this.

@HarryMichal HarryMichal linked a pull request Jan 8, 2022 that will close this issue
@HarryMichal HarryMichal added this to the Release 0.1.0 milestone Jan 8, 2022
@olivergs
Copy link
Collaborator

The problem right now is that the completion file shipped is out of sync with the completion system we already have implemented upstream.

If you want a workaround, just do:

toolbox completion bash > right_completions

and then

source ./right_completions

After that you will get the right behaviour.

The fix upstream should be as easy as replacing the current bash completion file with the contents of the right_completions file.

@oturpe
Copy link
Contributor Author

oturpe commented Jan 10, 2022

Thank you both!
Pull request #840 does fix the problem,
as does using the completions from $ toolbox completion bash.
However, both solutions could still be improved like I explain in this pr comment

I am also wondering, if there is a generator for completions in place,
why is it not run during build and the result installed?
Then the completions would never get out of sync.

@HarryMichal
Copy link
Member

Pull request #840 does fix the problem, as does using the completions from $ toolbox completion bash.

Mmm... I believe these are the same :).

However, both solutions could still be improved like I explain in this pr comment

Thanks for the insight!

I am also wondering, if there is a generator for completions in place, why is it not run during build and the result installed? Then the completions would never get out of sync.

That's what #840 is trying to accomplish :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants