Don't call external uname when $OSTYPE will do (#1911)

* lib/helpers: use `$OSTYPE` instead of `$(uname)`

* plugins/osx: use `$OSTYPE` instead of `$(uname)`

* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`

* plugins/python: use `$OSTYPE` instead of `$(uname)`

* plugins/base: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary

* completion/brew: use `$OSTYPE` instead of `$(uname)`

* completion/git: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[`.

* completion/fabric: use `$OSTYPE` instead of `uname`

* theme/demula: use `$OSTYPE` instead of `$(uname)`

* theme/rana: use `$OSTYPE` instead of `$(uname)`
This commit is contained in:
John D Pell
2021-08-14 00:20:12 -07:00
committed by GitHub
parent e321a3d657
commit de9ea54b81
10 changed files with 30 additions and 29 deletions

View File

@@ -5,7 +5,7 @@ about-completion "brew completion"
# Load late to make sure `system` completion loads first
# BASH_IT_LOAD_PRIORITY: 375
if [[ "$(uname -s)" != 'Darwin' ]]; then
if [[ "$OSTYPE" != 'darwin'* ]]; then
_log_warning "unsupported operating system - only 'Darwin' is supported"
return 0
fi

4
completion/available/fabric.completion.bash Normal file → Executable file
View File

@@ -41,8 +41,8 @@ export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~"
# Set command to get time of last file modification as seconds since Epoch
case `uname` in
Darwin|FreeBSD)
case "$OSTYPE" in
'darwin'*|'freebsd'*)
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
;;
*)

4
completion/available/git.completion.bash Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Only operate on MacOS since there are no linux paths
if [[ "$(uname -s)" != 'Darwin' ]] ; then
if [[ "$OSTYPE" != 'darwin'* ]] ; then
_log_warning "unsupported operating system - only 'Darwin' is supported"
return 0
fi
@@ -24,7 +24,7 @@ _git_bash_completion_paths=(
# Load the first completion file found
for _comp_path in "${_git_bash_completion_paths[@]}" ; do
if [ -r "$_comp_path" ] ; then
if [[ -r "$_comp_path" ]] ; then
_git_bash_completion_found=true
source "$_comp_path"
break