eXist-db / xst

Command line tool to interact with exist-db instances
https://npmjs.com/@existdb/xst
MIT License
17 stars 4 forks source link

Add completion for fish shell #95

Open line-o opened 1 year ago

line-o commented 1 year ago

Enhancement

As a user of the fish shell I would like xst to provide completions not only for zsh and bash but for fish as well.

This will finally be possible when https://github.com/yargs/yargs/pull/2281 is merged.

Alternatives

In the meantime you can already start with this script (ripped from the PR above)

Create a file ~/.config/fish/completions/xst.fish with following contents:

### xst completion - begin. generated by omelette.js ###
#
# yargs command completion script
#
#
function _xst_yargs_completion
  set cmd (commandline -b)
  for arg in (string split " " $cmd)
      set -a args "'$arg'"
  end
  set completions (eval xst --get-yargs-completions $args)
  for completion in $completions
    echo -e $completion
  end
end
complete -f -c xst -a '(_xst_yargs_completion)'
### xst completion - end ###