mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-22 09:19:47 +08:00
[split] Move localhost plugin to oh-my-fish/plugin-localhost
https://github.com/oh-my-fish/plugin-localhost
This commit is contained in:
parent
7ca03f3295
commit
5f6388df08
|
@ -1,33 +0,0 @@
|
|||
# Opens http://localhost:3000 (and other ports) in the default browser
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# open a commonly used port with just the port number
|
||||
# $ 3000
|
||||
#
|
||||
# open an arbitrary port using the `lh` command
|
||||
# $ lh 3001
|
||||
|
||||
## Functions
|
||||
function _open-installed
|
||||
which open >/dev/null ^&1
|
||||
end
|
||||
|
||||
## Main program
|
||||
function lh
|
||||
if _open-installed
|
||||
if [ (count $argv) -lt 1 ]
|
||||
echo "You need to specify a port to open"
|
||||
return 1
|
||||
end
|
||||
command open http://localhost:$argv
|
||||
else
|
||||
echo 'Requires open (MacOS only) to be installed'
|
||||
end
|
||||
end
|
||||
|
||||
set -l common_localhost_ports 3000 4000 5000 6000 7000 8000 8001 9000 8080
|
||||
|
||||
for port in $common_localhost_ports
|
||||
eval "function $port; lh $port; end"
|
||||
end
|
Loading…
Reference in New Issue
Block a user