Title: Support wp-cli
Last modified: September 1, 2016

---

# Support wp-cli

 *  Resolved [tariquesani](https://wordpress.org/support/users/tariquesani/)
 * (@tariquesani)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/support-wp-cli/)
 * On Github I noticed that wp-cli is a requirement, is it only for development/
   unit tests or command line generation is supported?
 * [https://wordpress.org/plugins/simply-static/](https://wordpress.org/plugins/simply-static/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [crgeary](https://wordpress.org/support/users/crgeary/)
 * (@crgeary)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/support-wp-cli/#post-7613664)
 * I’ve run through the source code and cannot find any kind of command line generation
   code.. I think it’s just for Unit Tests.
 * I really love this plugin (only started to look into it a few hours ago), but
   from what I can see, there are very few hooks to allow developers to integrate
   with it, and also doesn’t seem to be a nice/easy way to setup custom WP CLI commands
   for it.. That being said, if you wanted a CLI tool to generate the static site.
   Here’s a working (but crude) script:
 *     ```
       class SimplyStaticGenerator
       {
           public function generate($args = [], $assoc_args = [])
           {
               $done = $this->perform('start');
   
               while (!$done) {
                   $done = $this->perform('continue');
               }
   
               \WP_CLI::success('Done!');
           }
   
           protected function perform($action)
           {
               $archive_manager = new Simply_Static_Archive_Manager(new Simply_Static_Options(Simply_Static::SLUG));
               $archive_manager->perform($action);
   
               $state_name = $archive_manager->get_state_name();
               $done = $archive_manager->has_finished();
   
               \WP_CLI::success('In progress..');
   
               return $done;
           }
       }
   
       if (class_exists('WP_CLI')) {
           \WP_CLI::add_command('simply-static', '\SimplyStaticGenerator');
       }
       ```
   
 * I would backup before trying this out. I’ve probably missed something somewhere(
   as I say, only been looking at the plugin for a few hours, so I was “winging 
   it” when I did this).
 *  [B0RG](https://wordpress.org/support/users/b0rg/)
 * (@b0rg)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/support-wp-cli/#post-7613736)
 * [@crgeary](https://wordpress.org/support/users/crgeary/), how to exactly use 
   that? put it i a new file in the plugin folder? Sorry, I had no chance looing
   into the wp-cli code and how to wp-cli-ify wp plugins, but know how to ise it
   and see that many plugins would be great to use with wp-cli, this one is an especially
   well suited candidate.
 * wp-cli support is definitely needed for this plugin, would be very cool!
 *  [Scott at Code of Conduct](https://wordpress.org/support/users/codeofconduct/)
 * (@codeofconduct)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/support-wp-cli/#post-8204803)
 * Hi guys,
 * As crgeary correctly pointed out, WP-CLI is currently only used for unit tests,
   and isn’t directly integrated with Simply Static. This is definitely something
   I plan to support eventually, but I don’t have an ETA for it yet.
 * Best,
    Scott

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Support wp-cli’ is closed to new replies.

 * ![](https://ps.w.org/simply-static/assets/icon-256x256.png?rev=2443263)
 * [Simply Static - The Static Site Generator](https://wordpress.org/plugins/simply-static/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simply-static/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simply-static/)
 * [Active Topics](https://wordpress.org/support/plugin/simply-static/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simply-static/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simply-static/reviews/)

## Tags

 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * 3 replies
 * 4 participants
 * Last reply from: [Scott at Code of Conduct](https://wordpress.org/support/users/codeofconduct/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/support-wp-cli/#post-8204803)
 * Status: resolved