made npmrun a function
This commit is contained in:
parent
7684407e5c
commit
0ed6669a22
1 changed files with 19 additions and 1 deletions
20
.zshrc
20
.zshrc
|
@ -357,7 +357,25 @@ _coding_() {
|
||||||
|
|
||||||
# Check if npm is available, then create the alias
|
# Check if npm is available, then create the alias
|
||||||
if command_exists npm; then
|
if command_exists npm; then
|
||||||
alias npmrun="npm run dev -- --host=$(get_ip) --port=8001"
|
npmrun(){
|
||||||
|
npmrun_help() {
|
||||||
|
echo "Usage: npmrun [environment] [optional:port]"
|
||||||
|
echo " environment: The npm environment you want to run (e.g. dev)"
|
||||||
|
echo " port: Port to use (default: 8000)"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
|
||||||
|
npmrun_help
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local env="$1"
|
||||||
|
local port="${2:-8080}"
|
||||||
|
|
||||||
|
npm run "$env" -- --host="$(get_ip)" --port="$port"
|
||||||
|
|
||||||
|
}
|
||||||
|
# alias npmrun='npm run "$1" -- --host=$(get_ip) --port=8001'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue