Skip to content

Commit

Permalink
Refactor and cleanup code. Remove old commands. Update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Guarino committed Jun 16, 2022
1 parent f63d3e3 commit ff2b238
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 1,587 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (c) 2015-2016 Gabriel Guarino
Copyright (c) 2015-2022 Gabriel Guarino

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
112 changes: 6 additions & 106 deletions README.md
Expand Up @@ -39,7 +39,6 @@ These are the requirements to be able to run all the commands (the dependencies/

* Homebrew
* Git
* Python
* Pipe Viewer (pv)

---
Expand All @@ -58,19 +57,6 @@ You can uninstall Mac CLI by running:
---

### Integrated Projects

The following amazing projects have been integrated on the mac script (all the integrated projects are optional and can be installed through the installation wizard):
* Glances (https://github.com/nicolargo/glances)
* MySQL CLI (https://github.com/dbcli/mycli)
* fast-cli (https://github.com/sindresorhus/fast-cli)
* n98-magerun (https://github.com/netz98/n98-magerun)
* n98-magerun2 (https://github.com/netz98/n98-magerun2)
* imageOptim
* iStats

---

### Help / Commands List

| Command | Description | Arguments |
Expand All @@ -81,40 +67,35 @@ The following amazing projects have been integrated on the mac script (all the i

| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac update` | Install macOS software updates, update installed Ruby gems, Homebrew, npm and their installed packages | |
| `mac update` | Install macOS software updates, update installed Ruby gems, Homebrew, npm and their installed packages | |
| `mac lock` | Lock | |
| `mac restart` | Restart macOS | |
| `mac sleep` | Sleep mode | |
| `mac shutdown` | Shutdown | |
| `mac presentation` | Prepare MAC for presentation: minimize all apps, close browsers, send files from desktop and downloads to trash and set not disturb mode | |
| `mac time` | Show clock at top right position in Terminal/iTerm | |
| `mac time` | Show clock at top right position in Terminal/iTerm | |
| `mac screensaver` | Start screensaver | |
| `mac folders:list` | List folders in current directory with their current size | |
| `mac folders:list` | List folders in current directory with their current size | |
| `mac folder:size` | Calculate current folder size | |
| `mac folders:remove-empty` | Remove empty subdirectories | |
| `mac apps:close-all` | Close all opened apps | |
| `mac bluetooth:status` | Get the bluetooth status | |
| `mac bluetooth:enable` | Enable bluetooth | |
| `mac bluetooth:disable` | Disable bluetooth | |
| `mac wifi:status` | Get the wifi status | |
| `mac wifi:scan` | Scan available wifi networks | |
| `mac wifi:enable` | Enable wifi | |
| `mac wifi:disable` | Disable wifi | |
| `mac wifi:password` | Get password for current wifi network | |
| `mac dock:add-space N` | Add blank space to dock | N = number of spaces |
| `mac apps:app-store` | Get list of installed apps from App Store | |
| `mac eject-all` | Eject all mounted volumes and disks | |
| `mac battery` | Get battery status | |
| `mac info` | Get macOS version information | |
| `mac hidden:show` | Show hidden files | |
| `mac hidden:hide` | Hide hidden files | |
| `mac find:text X` | Find exact phrase recursively inside directory | X = Text string |
| `mac find:text X` | Find exact phrase recursively inside directory | X = Text string |
| `mac find:biggest-files` | Find biggest files inside directory | |
| `mac find:biggest-directories` | Find biggest directories inside directory | |
| `mac find:biggest-directories` | Find biggest directories inside directory | |
| `mac zip:extract X` | Extract Zip file to current folder | X = Zip file to extract |
| `mac gzip:compress X` | Compress current file using Gzip | X = File to compress |
| `mac gzip:extract X` | Extract Gzip file to current folder | X = Gzip file to extract |
| `mac tar:compress X` | Compress X file/directory using tar with progress indicator | X = File or directory |
| `mac tar:compress X` | Compress X file/directory using tar with progress indicator | X = File or directory |
| `mac tar:extract X` | Extract tar file to current folder | X = Tar file to extract |


Expand All @@ -123,7 +104,6 @@ The following amazing projects have been integrated on the mac script (all the i
| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac find:recent N` | Find files modified in the last N minutes | N = number of minutes |
| `mac find:duplicated` | Find duplicated files | |
| `mac search:replace X` | Search and replace string in file | X = File to perform the search and replace operation |


Expand All @@ -132,59 +112,24 @@ The following amazing projects have been integrated on the mac script (all the i
| Command | Description |
| ------------- | ------------- |
| `mac speedtest` | Internet connection speed test |
| `mac speedtest:infinite` | Run internet speed test each 5 minutes |
| `mac ports` | List of used ports |
| `mac ip:local` | Get local IP address |
| `mac ip:public` | Get public IP address |


### LAMP (Linux, Apache, MySQL, PHP) Utilities

| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac mysql` | Open Sequel PRO app) | |
| `mac mysql:cli` | Start MySQL CLI with autocompletion and syntax higlighting | |
| `mac mysql:list` | List all MySQL databases | |
| `mac mysql:dump-all` | Export all MySQL databases to individual files | |
| `mac mysql:dump X` | Export MySQL database to current directory | X = database name |
| `mac mysql:import X` | Import MySQL database | X = SQL file |
| `mac mysql:import-table X` | Import single MySQL database table | X = SQL file containing database table |
| `mac mysql:create X` | Create MySQL database | X = Database name |
| `mac mysql:drop X` | Remove MySQL database | X = Database name |
| `mac mysql:duplicate X` | Duplicate MySQL database | X = Database name |
| `mac mamp:start` | Start MAMP Server (Apache and MySQL) | |
| `mac mamp:stop` | Stop MAMP Server (Apache and MySQL) | |
| `mac mamp:restart` | Restart MAMP Server (Apache and MySQL) | |
| `mac php:syntax` | Check PHP Syntax for all PHP files in current location | |
| `mac php:info` | Get PHP info on command line | |
| `mac hosts:edit` | Edit hosts file | |


### SSH Utilities

| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac ssh:download-file X` | Download file from remote server through SSH | X = Path of the remote file to download |
| `mac ssh:download-folder X` | Download entire folder from remote server through SSH | X = Path of the remote folder to download |
| `mac ssh:download-database X` | Download MySQL from remote server through SSH | X = Name of the database to download |
| `mac ssh:sync:local X` | Sync local folder with remote folder using rsync through SSH (download remote folder to local folder) | X = Path of the remote folder to sync to local folder |
| `mac ssh:sync:remote X` | Sync remote folder with local folder using rsync through SSH (upload local folder to remote folder) | X = Path of the remote folder to sync from local folder |
| `mac ssh:upload X` | Upload file to remote server through SSH | X = Path of the file to upload to the remote server |
| `mac ssh:public-key` | Copy SSH Public Key | |
| `mac ssh:list` | List all the saved SSH credentials | |


### Web Development Utilities

| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac dev:monitor X` | Monitor file changes (for example: log files) | X = File to monitor |
| `mac dev:compass:compile` | Compile current folder using compass | |
| `mac dev:sass` | Compile current folder using SASS | |
| `mac dev:optimize-images` | Optimize all images in current directory and subdirectories |
| `mac dev:css:convert-to-scss` | Convert CSS file to SCSS |


### Performance and maintenance Utilities

| Command | Description |
Expand All @@ -194,15 +139,6 @@ The following amazing projects have been integrated on the mac script (all the i
| `mac memory` | See memory usage sorted by memory consumption |
| `mac trash:empty` | Empty trash |
| `mac trash:size` | Calculate trash size |
| `mac desktop:cleanup` | Remove all files and directories from Desktop directory |
| `mac downloads:cleanup` | Remove all files and directories from Downloads directory |


### iTerm / Terminal Utilities

| Command | Description |
| ------------- | ------------- |
| `mac iterm:tab-title` | Set title of current iTerm tab |


### Git Utilities
Expand All @@ -219,48 +155,12 @@ The following amazing projects have been integrated on the mac script (all the i
| `mac git:branch:rename` | Rename Git branch |
| `mac git:branch:remove-local` | Remove local Git branch |
| `mac git:branch:remove-remote` | Remove local and remote Git branch |
| `mac git:remove` | Remove Git from current project |
| `mac git:settings` | Check Git settings |
| `mac git:add-removed` | Add removed files to staged files |
| `mac git:size` | Get size for current Git directory |

### Web Utilities

| Command | Description | Arguments |
| ------------- | ------------- | ------------- |
| `mac web:download-images` | Download all images from website to current directory |

### Homebrew Utilities

| Command | Description |
| ------------- | ------------- |
| `mac brew` | Get a list of installed Homebrew packages |


### Xcode Utilities

| Command | Description |
| ------------- | ------------- |
| `mac xcode:cleanup` | Cleanup Xcode files to free up hard disk space |


### Image Utilities

| Command | Description | Arguments
| ------------- | ------------- | ------------- |
| `mac image:generate:mobile-app-icons X Y` | Generate mobile app icons | X = Original image file, Y = Output path |


### Magento Utilities

| Command | Description |
| ------------- | ------------- |
| `mac magento:version` | Get Magento version from current project on command line |
| `mac magento:customer:create` | Create Magento customer with sample address and sample credit card information |
| `mac magento:fix-permissions` | Fix Magento permissions for files and directories |
| `mac magento:order:create` | Create sample order in Magento |
| `mac magento:shell-script:create` | Create script in Magento shell folder to be run from command line |
| `mac magento:gitignore:create` | Create gitignore file for Magento project |
| `mac magento:url-rewrites:enable` | Enable Magento URL rewrites |
| `mac magento:url-rewrites:disable` | Disable Magento URL rewrites |
| `mac magento2:install` | Install Magento 2 in current folder |
56 changes: 0 additions & 56 deletions mac
Expand Up @@ -19,11 +19,6 @@ MAC="$(dirname "$0")"
#--------------------------------------------------------------------
export cli_path="/usr/local/bin/"
export plugins_path="/usr/local/bin/mac-cli/"
export mysql="/Applications/MAMP/Library/bin/mysql"
export mysql_socket="/Applications/MAMP/tmp/mysql/mysql.sock"
export mysql_user="root"
export mysql_password="root"
export mysqldump="/Applications/MAMP/Library/bin/mysqldump"
export dropbox_folder="/Users/$(id -u -n)/Dropbox/"
export php="/Applications/MAMP/bin/php/php5.5.26/bin/php"
export php_cli=$(which php)
Expand Down Expand Up @@ -62,15 +57,13 @@ COMMANDS=(
general
search
network
lamp
ssh
webdev
performance
terminal
git
web_utilities
homebrew
xcode
image
magento
update
Expand All @@ -81,8 +74,6 @@ COMMANDS=(
sleep
display
shutdown
time
presentation
uptime
volume
volume:ismute
Expand All @@ -93,8 +84,6 @@ COMMANDS=(
screensaver
folders:list
folder:size
folders:remove-empty
apps:close-all
dock:add-space
bluetooth:status
bluetooth:enable
Expand All @@ -103,8 +92,6 @@ COMMANDS=(
wifi:scan
wifi:enable
wifi:disable
wifi:password
apps:app-store
eject-all
battery
info
Expand All @@ -119,48 +106,22 @@ COMMANDS=(
find:recent
search:replace
speedtest
speedtest:infinite
ports
ip:local
ip:public
dhcp:renew
dns:clear
mysql
mysql:cli
mysql:list
mysql:export-all
mysql:export
mysql:import
mysql:import-table
mysql:create
mysql:drop
mysql:duplicate
mysql:dump
mamp:start
mamp:stop
mamp:restart
php:syntax
php:info
hosts:edit
ssh:download-file
ssh:download-folder
ssh:download-database
ssh:sync:local
ssh:sync:remote
ssh:upload
ssh:public-key
ssh:list
dev:monitor
dev:optimize-images
dev:css:convert-to-scss
system
temp
memory
trash:empty
trash:size
desktop:cleanup
downloads:cleanup
iterm:tab-title
git:config
git:open
git:create:branch
Expand All @@ -171,24 +132,11 @@ COMMANDS=(
git:branch:rename
git:branch:remove-local
git:branch:remove-remote
git:remove
git:branch
git:settings
git:add-removed
git:size
web:download-images
brew:update
xcode:cleanup
image:generate:mobile-app-icons
magento:version
magento:customer:create
magento:fix-permissions
magento:order:create
magento:shell-script:create
magento:gitignore:create
magento:url-rewrite:enable
magento:url-rewrites:disable
magento2:install
)
## ---- END OF COMMANDS; Comment required for bash_completion------

Expand Down Expand Up @@ -228,13 +176,9 @@ source "$MAC/mac-cli/plugins/general"
source "$MAC/mac-cli/plugins/git"
source "$MAC/mac-cli/plugins/image"
source "$MAC/mac-cli/plugins/brew"
source "$MAC/mac-cli/plugins/iterm"
source "$MAC/mac-cli/plugins/lamp"
source "$MAC/mac-cli/plugins/magento"
source "$MAC/mac-cli/plugins/network"
source "$MAC/mac-cli/plugins/performance"
source "$MAC/mac-cli/plugins/search"
source "$MAC/mac-cli/plugins/ssh"
source "$MAC/mac-cli/plugins/web"
source "$MAC/mac-cli/plugins/xcode"
source "$MAC/mac-cli/plugins/volume"

0 comments on commit ff2b238

Please sign in to comment.