Helper functions to make subcommands completions easier with fish.
Using fundle (recommended)
Add
fundle plugin 'tuvistavie/fish-completion-helpers'
to your config.fish and run fundle install.
Add the two files in the functions directory in ~/.config/fish/functions.
For the program main commands, add __fish_prog_needs_command to complete condition (-n flag). Example:
complete -f -c cmd -n '__fish_prog_needs_command' -a start -d "start my cmd"
For the program subcommands, add __fish_prog_using_command SUBCMD to complete condition (-n flag). Example:
complete -f -c cmd -n '__fish_prog_using_command start' -l daemon "start as daemon"