Created
September 14, 2024 10:31
-
-
Save judy2k/6c85366803e93c19c677d49e81544c65 to your computer and use it in GitHub Desktop.
Fish Shell: Expand 'run' to an appropriate 'run' command, depending on the files in the current directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _expand_run | |
-d "Expand the 'run' abbreviation into a project-specific run command."; | |
if test -e Justfile; | |
echo just run | |
else if test -e Makefile; | |
echo make run | |
else if test -e Cargo.toml | |
echo cargo run | |
else if test -e package.json | |
echo npm run dev | |
end | |
end | |
abbr --add run --function _expand_run; | |
abbr --add r --function _expand_run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment