mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Make umask work on OS X
https://github.com/fish-shell/fish-shell/issues/515
This commit is contained in:
parent
1163961927
commit
acbb6fb8e2
2 changed files with 20 additions and 20 deletions
|
@ -5,23 +5,15 @@ function type --description "Print the type of a command"
|
||||||
set -l res 1
|
set -l res 1
|
||||||
set -l mode normal
|
set -l mode normal
|
||||||
set -l selection all
|
set -l selection all
|
||||||
|
|
||||||
set -l new_getopt
|
|
||||||
if not getopt -T > /dev/null
|
|
||||||
set new_getopt 1
|
|
||||||
else
|
|
||||||
set new_getopt ''
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get options
|
# Get options
|
||||||
#
|
#
|
||||||
set -l options
|
set -l options
|
||||||
set -l shortopt tpPafh
|
set -l shortopt tpPafh
|
||||||
set -l longopt
|
if not getopt -T > /dev/null
|
||||||
if test $new_getopt
|
|
||||||
# GNU getopt
|
# GNU getopt
|
||||||
set longopt type,path,force-path,all,no-functions,help
|
set -l longopt type,path,force-path,all,no-functions,help
|
||||||
set options -o $shortopt -l $longopt --
|
set options -o $shortopt -l $longopt --
|
||||||
# Verify options
|
# Verify options
|
||||||
if not getopt -n type $options $argv >/dev/null
|
if not getopt -n type $options $argv >/dev/null
|
||||||
|
|
|
@ -138,19 +138,27 @@ function umask --description "Set default file permission mask"
|
||||||
|
|
||||||
set -l as_command 0
|
set -l as_command 0
|
||||||
set -l symbolic 0
|
set -l symbolic 0
|
||||||
|
|
||||||
set -l shortopt -o pSh
|
set -l options
|
||||||
set -l longopt
|
set -l shortopt pSh
|
||||||
if not getopt -T >/dev/null
|
if not getopt -T >/dev/null
|
||||||
|
# GNU getopt
|
||||||
set longopt -l as-command,symbolic,help
|
set longopt -l as-command,symbolic,help
|
||||||
|
set options -o $shortopt -l $longopt --
|
||||||
|
# Verify options
|
||||||
|
if not getopt -n umask $options $argv >/dev/null
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Old getopt, used on OS X
|
||||||
|
set options $shortopt
|
||||||
|
# Verify options
|
||||||
|
if not getopt $options $argv >/dev/null
|
||||||
|
return 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not getopt -n umask -Q $shortopt $longopt -- $argv >/dev/null
|
set -l tmp (getopt $options $argv)
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l tmp (getopt $shortopt $longopt -- $argv)
|
|
||||||
|
|
||||||
eval set opt $tmp
|
eval set opt $tmp
|
||||||
|
|
||||||
while count $opt >/dev/null
|
while count $opt >/dev/null
|
||||||
|
|
Loading…
Reference in a new issue