Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Last active July 28, 2017 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkubicek/bc63d0e6012b45b07156aae6912ec6f1 to your computer and use it in GitHub Desktop.
Save jkubicek/bc63d0e6012b45b07156aae6912ec6f1 to your computer and use it in GitHub Desktop.
Script running Fish script

The s function takes a single string argument and runs an executable located in the ./scripts/ directory that has the same path as the parameter

function s --argument SCRIPT_NAME
  eval ./scripts/$SCRIPT_NAME
end

The print-scripts function returns a space-separated list of all executables located in ./scripts/

function print-scripts
  find scripts -perm +111 -type f | sed 's$scripts/$$' | tr '\n' ' '
end

Setup the autocomplete for s so that it autocompletes only the executables located in the scripts directory.

complete --command s -a (print-scripts) --no-files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment