Skip to content

Commit

Permalink
Reformat code: Replace if statements with case
Browse files Browse the repository at this point in the history
  • Loading branch information
guarinogabriel committed Jul 9, 2016
1 parent ad68eab commit 1e4e7d8
Show file tree
Hide file tree
Showing 17 changed files with 1,467 additions and 1,253 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The following amazing projects have been integrated on the mac script (all the i
| `mac apps:close-all` | Close all opened apps | |
| `mac apps:app-store` | Get list of installed apps from App Store | |
| `mac eject-all` | Eject all mounted volumes and disks | |
| `mac battery:status` | Get battery status | |
| `mac battery` | Get battery status | |
| `mac info` | Get OS X version information | |
| `mac hidden:show` | Show hidden files | |
| `mac hidden:hide` | Hide hidden files | |
Expand Down
2 changes: 1 addition & 1 deletion mac
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ COMMANDS=(
apps:close-all
apps:app-store
eject-all
battery:status
battery
info
find:text
find:biggest-files
Expand Down
10 changes: 6 additions & 4 deletions mac-cli/misc/help
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# mac script commands list - all commands
#--------------------------------------------------------------------

if [[ "$fn" == "list" || "$fn" == "help" ]]; then
case "$fn" in
"list"|"help")

echo "\n${WHITEBOLD} mac CLI – OS X command line tools for developers"
echo "${WHITEBOLD}===================================================="
Expand All @@ -29,7 +30,7 @@ if [[ "$fn" == "list" || "$fn" == "help" ]]; then
echo "${LIGHTBLUE}mac apps:close-all${GRAY}: Close all opened apps"
echo "${LIGHTBLUE}mac apps:app-store${GRAY}: Get list of installed apps from App Store"
echo "${LIGHTBLUE}mac eject-all${GRAY}: Eject all mounted volumes and disks"
echo "${LIGHTBLUE}mac battery:status${GRAY}: Get battery information"
echo "${LIGHTBLUE}mac battery${GRAY}: Get battery information"
echo "${LIGHTBLUE}mac info${GRAY}: Get OS X version information"
echo "${LIGHTBLUE}mac find:text ${LIGHTGREEN}X${GRAY}: Find exact phrase recursively inside directory - ${LIGHTGREEN}X = Text string"
echo "${LIGHTBLUE}mac find:biggest-files ${GRAY}: Find biggest files inside directory"
Expand Down Expand Up @@ -115,7 +116,7 @@ if [[ "$fn" == "list" || "$fn" == "help" ]]; then
echo "${LIGHTBLUE}mac git:branch:remove-local${GRAY}: Remove local Git branch "
echo "${LIGHTBLUE}mac git:branch:remove-remote${GRAY}: Remove local and remote Git branch "
echo "${LIGHTBLUE}mac git:removeecho "${LIGHTBLUE}mac git:branch${GRAY}: See all branches "${GRAY}: Remove Git from current project "
echo "${LIGHTBLUE}mac git:settings${GRAY}: Check Git settings "
echo "${LIGHTBLUE}mac git:config${GRAY}: Check Git settings "
echo "${LIGHTBLUE}mac git:add-removed${GRAY}: Add removed files to staged files "
echo "${LIGHTBLUE}mac git:size${GRAY}: Get size for current Git repository "

Expand Down Expand Up @@ -149,5 +150,6 @@ if [[ "$fn" == "list" || "$fn" == "help" ]]; then
echo "${LIGHTBLUE}mac magento2:install${GRAY}: Install Magento 2 in current directory "

echo "${NC}"
;;

fi
esac
28 changes: 18 additions & 10 deletions mac-cli/plugins/brew
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
# Homebrew Utilities
#--------------------------------------------------------------------

# Get list of installed Homebrew packages
if [ "$fn" == "brew:list" ]; then
brew list
elif [[ "$fn" == "brew:update" ]]; then
echo "Updating Homebrew and its installed packages..."
if [ "$echocommand" == "true" ]; then
echo "${GREEN}brew update; brew upgrade --all; brew cleanup;\n${NC}"
fi
brew update; brew upgrade --all; brew cleanup;
fi
case "$fn" in

# Get list of installed Homebrew packages
"brew:list")
brew list
;;


# Update Homebrew and installed packages
"brew:update")
echo "Updating Homebrew and its installed packages..."
if [ "$echocommand" == "true" ]; then
echo "${GREEN}brew update; brew upgrade --all; brew cleanup;\n${NC}"
fi
brew update; brew upgrade --all; brew cleanup;
;;

esac
Loading

0 comments on commit 1e4e7d8

Please sign in to comment.