Last active
April 18, 2019 23:15
-
-
Save msikma/addce5c8cd218c863e1e4b297aa6ae7b 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 2 ]; # we've just opened a new Terminal session \ | |
# Uncomment this if you only want the project info to be shown when coming from a lower directory. | |
# 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, npm scripts and docs. | |
project.js | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment