WP Smush using WP-CLI

If you use WP Smush then you should know that you can use it via WP-CLI too. This feature became available since the version 3.1

Here are some commands:

/**
 * Optimize image.
 *
 * ## OPTIONS
 *
 * [--type=<type>]
 * : Optimize single image, batch or all images.
 * ---
 * default: all
 * options:
 *   - all
 *   - single
 *   - batch
 * ---
 *
 * [--image=<ID>]
 * : Attachment ID to compress.
 * ---
 * default: 0
 * ---
 *
 * ## EXAMPLES
 *
 * # Smush all images.
 * $ wp smush compress
 *
 * # Smush single image with ID = 10.
 * $ wp smush compress --type=single --image=10
 *
 * # Smush first 5 images.
 * $ wp smush compress --type=batch --image=5
 */

There are more commands which you can find on /core/class-wp-smush-cli-command.php