Skip to content

Commit

Permalink
Renaming references from osx to macos (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpedrorodrigues authored Nov 4, 2023
1 parent 2ea78dd commit f6875af
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cli/.internal/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source "${library_path}/github.sh"
source "${library_path}/logging.sh"
source "${library_path}/network.sh"
source "${library_path}/os.sh"
source "${library_path}/osx.sh"
source "${library_path}/macos.sh"
source "${library_path}/repl.sh"
source "${library_path}/requirements.sh"
source "${library_path}/sphynx.sh"
Expand Down
2 changes: 1 addition & 1 deletion cli/.internal/library/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function sx::uuid() {

local -r id="$(uuidgen)"

if sx::os::is_osx; then
if sx::os::is_macos; then
sx::log::info "${id}"
else
sx::log::info "${id^^}"
Expand Down
10 changes: 5 additions & 5 deletions cli/.internal/library/osx.sh → cli/.internal/library/macos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

function sx::osx::airport() {
if sx::os::is_osx; then
function sx::macos::airport() {
if sx::os::is_macos; then
'/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport' "${@}"
else
sx::log::fatal 'The airport command is not available in your OS'
Expand All @@ -10,7 +10,7 @@ function sx::osx::airport() {

# References:
# - http://blog.macromates.com/2006/keychain-access-from-shell
function sx::osx::keychain_pass() {
function sx::macos::keychain_pass() {
local -r account="${1:-}"

if [ -z "${account:-}" ]; then
Expand All @@ -33,8 +33,8 @@ function sx::osx::keychain_pass() {
echo "${password}"
}

function sx::osx::default_browser_application() {
if sx::os::is_osx; then
function sx::macos::default_browser_application() {
if sx::os::is_macos; then
local -r browser_id="$(
defaults read com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers \
| grep 'LSHandlerURLScheme = https;' -B1 \
Expand Down
4 changes: 2 additions & 2 deletions cli/.internal/library/network.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

function sx::network::current::ssid() {
if sx::os::is_osx; then
sx::osx::airport -I en1 | grep -i SSID | tail -n 1 | sed 's/SSID://g' | sed 's/ //g'
if sx::os::is_macos; then
sx::macos::airport -I en1 | grep -i SSID | tail -n 1 | sed 's/SSID://g' | sed 's/ //g'
else
nmcli -t -f active,ssid dev wifi | grep -E '^yes' | cut -d ':' -f2
fi
Expand Down
6 changes: 3 additions & 3 deletions cli/.internal/library/os.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

function sx::os::is_osx() {
function sx::os::is_macos() {
[ "$(uname)" = 'Darwin' ]
}

Expand Down Expand Up @@ -54,8 +54,8 @@ function sx::os::browser::open() {
return 0
fi
done
elif sx::os::is_osx; then
local -r browser_application="$(sx::osx::default_browser_application)"
elif sx::os::is_macos; then
local -r browser_application="$(sx::macos::default_browser_application)"
if [ -n "${browser_application}" ]; then
open -a "${browser_application}" "${*}"
return 0
Expand Down
6 changes: 3 additions & 3 deletions cli/.internal/library/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ function sx::require_linux() {
fi
}

function sx::require_osx() {
if ! sx::os::is_osx; then
function sx::require_macos() {
if ! sx::os::is_macos; then
sx::log::fatal 'You are not running on a MacOS machine'
fi
}

function sx::require_supported_os() {
if ! sx::os::is_osx && ! sx::os::is_linux; then
if ! sx::os::is_macos && ! sx::os::is_linux; then
sx::log::fatal 'You are not running on a supported OS'
fi
}
4 changes: 2 additions & 2 deletions cli/browser/core/kill-tabs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
function sx::browser::kill_tabs::chrome() {
if sx::os::is_osx; then
if sx::os::is_macos; then
local -r output="$(pgrep \
-ifl \
'[C]hrome.*--type=renderer')"
Expand All @@ -24,7 +24,7 @@ function sx::browser::kill_tabs::chrome() {
}

function sx::browser::kill_tabs::firefox() {
if sx::os::is_osx; then
if sx::os::is_macos; then
local -r output="$(pgrep \
-ifl \
'[F]irefox.*-isForBrowser')"
Expand Down
2 changes: 1 addition & 1 deletion cli/shell/core/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function sx::shell::run_tests() {

local -r sh="${1}"

if sx::os::is_osx; then
if sx::os::is_macos; then
sw_vers
echo
fi
Expand Down
2 changes: 1 addition & 1 deletion cli/system/core/clear-trash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function sx::system::clear_trash() {
sx::require_supported_os

if sx::os::is_osx; then
if sx::os::is_macos; then
sx::require 'sqlite3'

for log_file in /private/var/log/asl/*.asl; do
Expand Down
2 changes: 1 addition & 1 deletion cli/system/core/dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function sx::system::flush_cache() {
sx::require_supported_os

if sx::os::is_osx; then
if sx::os::is_macos; then
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder mDNSResponderHelper
else
Expand Down
2 changes: 1 addition & 1 deletion cli/system/core/ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function sx::system::ip::public() {
function sx::system::ip::gateway() {
sx::require_supported_os

if sx::os::is_osx; then
if sx::os::is_macos; then
netstat -rn | grep 'default' | head -n 1 | awk '{ print $2 }'
else
ip route | grep 'default' | awk '{ print $3 }'
Expand Down
2 changes: 1 addition & 1 deletion cli/workstation/core/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function sx::workstation::setup() {

export ANSIBLE_CONFIG="${SPHYNX_DIR}/playbooks"

if sx::os::is_osx; then
if sx::os::is_macos; then
local -r playbook_path="${ANSIBLE_CONFIG}/macos/main.yml"
else
local -r playbook_path="${ANSIBLE_CONFIG}/linux/main.yml"
Expand Down

0 comments on commit f6875af

Please sign in to comment.