There's three solutions here:
1. Put the functions into function files
2. Put the functions into a file that you then source
3. `source` one completion script from the other
Number 1 is what we prefer (though it's possible to find a better
solution). Note that, if you put multiple functions into the file, you'll
need to make sure that the function the file is named after is always
called first, and that's somewhat tricky and not squeaky clean. The
alternative is one file per function.
Number 2 sounds nice, but I'm not sure where that file would be stored then.
Number 3 might actually be okay, though if this is for public consumption
you'd need to be careful to consider $fish_complete_path.
All this is of course if the completions of `zpool` aren't a subset of the
ones for `zfs` (or the other way around). If that is the case, you could
just use `complete -c zpool -w zfs` and then add the ones specific to zpool.
On Tue, May 9, 2017 at 5:05 PM Mike Meyer <m...@mired.org> wrote:
> Ok, now for the next issue.
>
> zfs has two tools, zpool (for dealing with pools) and zfs (for file data
> sets in pools). A zpool has an implicit data set that has the same name as
> the pool, and a few of the commands for manipulating pools have options
> that apply to that dataset, and will complete the same way as the dataset.
>
> Since some of these are complicated, I'd rather not duplicated the code
> but use the functions in the zfs.fish file for it's completions. Is there
> sone way to force that to load from zpool.fish?
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users