Last active
September 25, 2018 23:32
-
-
Save msikma/a5ee8252c3629fb9cb0f38db69bc9d90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 check_node_project \ | |
--description 'Display project info if we changed to a Node project directory' \ | |
--on-variable dirprev | |
# Don't display project info if: | |
status --is-command-substitution; # this is command substitution \ | |
or not test -f ./package.json; # there's no package.json \ | |
or [ (count $dirprev) -lt 3 ]; # we've just opened a new Terminal session \ | |
or [ (count (string split $PWD $dirprev[-1])) -eq 2 ]; # we came from a lower directory in the hierarchy \ | |
and return | |
# Displays project name, version, and a list of bin files and npm scripts. | |
node-project.js | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment