wordpress from the command line

Decided to see if I could find a way to post to wordpress from the command line today. Promptly found wp-cli, which seemed to be the business. Promptly spent an hour trying to get it to install on Windows 10. I had to install php & composer first, only to find that method did not work. Then I had to download a .phar file and write a batch to install it. I also had to go fiddling with system path variables.

Would it be quicker if I knew what I was doing? Sure.
Would it take less than 2 minutes if I used Linux/OSX? Probably.

But neither of those conditions held true. I’m not au-fait with composer (though I should be I’m sure) and I don’t run Linux because I develop I use Visual Studio for work. More than that, all the many times I’ve tried various flavours of Linux over the years, they just haven’t floated my boat. They always feel unfinished.

Maybe soon I’ll try again, and maybe I’ll like it, but that’s for another post.

So I finally got wp-cli installed, and wasted about another 30 minutes trying to connect to wordpress. It seems that it wants me to install WP to a root folder, and then it can do command line stuff to that install. So basically, I have to run it on the server on which I have WP installed.

And I’m out.

Aside from taking hours to get up and running, and finding it doesn’t do what I want, the complexity is crazy, for a simple command line tool. The wp-cli folder installed has a brain numbing 2,635 files, and clocks in at 10mb. WordPress itself isn’t that complex, with just over 1,500 files and taking 50mb of my SSD. How can the simple command line tool to post to wordpress need 1,000 more files than wordpress itself? Granted this is a cloned git project, so a lot of that is probably not strictly necessary to the compiled app, but still it boggles the mind.

I abandoned wp-cli, and found a node.js library called “wordpress” which is ‘only’ 500 files (though these are hidden away in my node_modules folder). I can write a single node script that will do most of what I need to my remote wordpress install. If I’d only done this to begin with, those 90+ minutes would have been better spent.