distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Suggestion] Provide fish shell completions / Fix commands format in the man page

Open buonhobo opened this issue 1 year ago • 8 comments

Is your feature request related to a problem? Please describe. Distrobox man pages specify commands using the following layout:

distrobox create

              --image/-i:     image to use for the container  default: ${container_image_default}
              --name/-n:      name for the distrobox          default: ${container_name_default}
              --hostname:     hostname for the distrobox      default: <container-name>.$(uname -n)
              --pull/-p:      pull the image even if it exists locally (implies --yes)
              --yes/-Y:       non-interactive, pull images without asking

This is fine for a human, but it causes fish shell to have buggy completions:

❯ distrobox-create --absolutely-disable-root-password-i-am-really-positively-sure 
--absolutely-disable-root-password-i-am-really-positively-sure  (COMPATIBILITY for a list of compatible images and container managers, please …)
--additional-flags/-a                                                                                                                           
--additional-packages/-ap                                                                                                                       
--clone/-c                                                                  (this will be useful to either rename an existing distrobox or hav…)
--compatibility/-C                                                                                                                              
--dry-run/-d                                                                                                                                    
--help/-h                                                                                                                                       
--home/-H                                                                                                                                       
--hostname                                                                                                                                      
--image/-i                                                                                                                                      
--init/-I                                                                   (this will make host[aq]s processes not visible from within the co…)
--init-hooks                                                                                                                                    
--name/-n                                                                                                                                       
--no-entry                                                                                                                                      
--nvidia                                                                                                                                        
--pre-init-hooks                                                                                                                                
--pull/-p                                                                                                                                       
--root/-r                                                                   (way over [dq]sudo distrobox[dq] (note: if using a program other t…)

As you can see, the completion are in the format --longcommand/-shortcommand and if you complete your prompt using TAB then the completion will not work. You have to manually go and delete the last part

Describe the solution you'd like I'd like the distrobox man page to list commands in the man page in the classic format, or at least I'd like for it to provide correct fish shell completions which is all I really care about.

buonhobo avatar May 30 '24 13:05 buonhobo

I'm not familiar at all with fish, so I'm going to ask help to anyone interested in this :)

89luca89 avatar Oct 12 '24 11:10 89luca89

https://github.com/89luca89/distrobox/issues/1671

boredsquirrel avatar Feb 05 '25 13:02 boredsquirrel

I've started the work to convert the man pages to use a more standard format at https://github.com/89luca89/distrobox/pull/1755, it's still a draft PR

@89luca89 basically what happens is that the fish shell can generate completions automatically by parsing man pages (via fish_update_completions). Unfortunately the format that distrobox uses for its man pages is not compatible with what fish expects. My PR just changes the format so that fish can parse the man pages properly.

esteve avatar May 13 '25 14:05 esteve

Ok, I wasn't sure if I should pull the trigger to create a PR for this. I did create fish shell completions. They are still a bit rough around the edges. Image completion doesn't work well in it's current state using the -i and --image arguments. Probably some more general cleanup as well. Overall, most everything works as intended though.

Should I move forward and open a draft PR? I may need some help with cleanup as I'm fairly n00bish with fish...

https://github.com/89luca89/distrobox/compare/main...dasunsrule32:distrobox:feat/fish-shell-completion?expand=1

dasunsrule32 avatar Jun 12 '25 20:06 dasunsrule32