diff options
author | Marc Cornellà <marc.cornella@live.com> | 2015-08-05 00:27:51 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2015-08-05 00:27:51 +0200 |
commit | 2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7 (patch) | |
tree | 15bc8fe41fc24645c151ee91325d75dd445ecc10 /lib/functions.zsh | |
parent | 3d5b3430fd9da12f6e33f534e487fe9b18928ac7 (diff) | |
download | zsh-2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7.tar.gz zsh-2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7.tar.bz2 zsh-2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7.zip |
Implement cross-platform open function open_command()
For now this supports:
- Mac OS X
- Linux (presumably works on all versions)
- Cygwin (Windows)
Diffstat (limited to 'lib/functions.zsh')
-rw-r--r-- | lib/functions.zsh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh index 17f5f9cbf..0d632a268 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,6 +15,22 @@ function take() { cd $1 } +function open_command() { + local open_cmd + + # define the open command + case "$OSTYPE" in + darwin*) open_cmd="open" ;; + cygwin*) open_cmd="cygstart" ;; + linux*) open_cmd="xdg-open" ;; + *) echo "Platform $OSTYPE not supported" + return 1 + ;; + esac + + nohup $open_cmd "$@" &>/dev/null +} + # # Get the value of an alias. # |