click-complete.fish 686 B

12345678910111213141516171819202122
  1. function _click_completion;
  2. set -l response;
  3. for value in (env _FLEXMEASURES_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) flexmeasures);
  4. set response $response $value;
  5. end;
  6. for completion in $response;
  7. set -l metadata (string split "," $completion);
  8. if test $metadata[1] = "dir";
  9. __fish_complete_directories $metadata[2];
  10. else if test $metadata[1] = "file";
  11. __fish_complete_path $metadata[2];
  12. else if test $metadata[1] = "plain";
  13. echo $metadata[2];
  14. end;
  15. end;
  16. end;
  17. complete --no-files --command flexmeasures --arguments "(_click_completion)";