From 3e115b7a85184d16a5bb8d00fff702a62e3f8fea Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Fri, 16 Aug 2013 20:47:04 +0200 Subject: [PATCH] Mac OS X doesn't support uname -o. Use uname instead. I break compatibility with Mac OS X again, that I don't have access to. Result: Stuff break, and I have to fix it, so it will perhaps work. At least, I hope it will work. --- share/functions/__fish_pwd.fish | 5 +++-- share/functions/hostname.fish | 4 +++- share/functions/prompt_pwd.fish | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/share/functions/__fish_pwd.fish b/share/functions/__fish_pwd.fish index d072c6fab..282728715 100644 --- a/share/functions/__fish_pwd.fish +++ b/share/functions/__fish_pwd.fish @@ -1,8 +1,9 @@ -if test (uname -o) = Cygwin +switch (uname) +case 'CYGWIN_*' function __fish_pwd --description "Show current path" pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-' end -else +case '*' function __fish_pwd --description "Show current path" pwd end diff --git a/share/functions/hostname.fish b/share/functions/hostname.fish index eb667ef85..8caaca7cc 100644 --- a/share/functions/hostname.fish +++ b/share/functions/hostname.fish @@ -1,5 +1,7 @@ # Query for USERDOMAIN to shorten waiting times when OS isn't Windows. -if set -q USERDOMAIN; and test (uname -o) = Cygwin +set -q USERDOMAIN +and switch (uname) +case 'CYGWIN_*' # Cygwin's hostname is broken when computer name contains Unicode # characters. This hack "fixes" hostname in Cygwin. function hostname --description "Show or set the system's host name" diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index ed6eb3d91..f559fb046 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -1,12 +1,13 @@ -if test (uname) = Darwin +switch (uname) +case Darwin function prompt_pwd --description "Print the current working directory, shortend to fit the prompt" echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/private||' -e 's-\([^/.]\)[^/]*/-\1/-g' end -else if test (uname -o) = Cygwin +case 'CYGWIN_*' function prompt_pwd --description "Print the current working directory, shortend to fit the prompt" echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/cygdrive/\(.\)|\1/:|' -e 's-\([^/.]\)[^/]*/-\1/-g' -e 's-^\([^/]\)/:/\?-\u\1:/-' end -else +case '*' function prompt_pwd --description "Print the current working directory, shortend to fit the prompt" echo $PWD | sed -e "s|^$HOME|~|" -e 's-\([^/.]\)[^/]*/-\1/-g' end