,

How to post with WP-CLI

Right, so this is probably not for everyone – but I just wanted to share.

#Disclaimer

I am real big fan of VI and I do tend to think the default WordPress interface is a bit confusing, especially – if you just want to write.

 

Too many option, too much stuff on the screen.

 

When the stress is ON and my attention-span is reduced to the one of a goldfish, it becomes really easy to lose your focus – and WordPress admin doesn’t help much. That is why I like VI so much – and thereore I was looking for a way to deploy it for the management of my writing.

Vim plugin – not this time

Before you just say – “hey there is a plugin for that” – (If you don’t know, Vim as a bunch of plugin and I would advise you check VimAwesome to get an idea of how many things you can do with this tiny piece of software.) So obviously among all the plugins, there are a few dedicated to manage your WordPress blog directly in VIM. However, after I tried doing this in the past with Sublime Text – turned out to be too much of an issue and was interfering with my regular coding sessions.

WP-CLI is your friend

So lets start with the fact that WP-CLI *is* awesome in itself.

In case you never heard of it – it is a very clean – intuitive – command line tool for managing WordPress.

It is designed to handle most of (nearly everything) of WordPress (and if you wanna more about it – just go check their website)

and it turns out you have a few “interactive” editing tools for publish…

 

Handy commands

$ wp post <command>

The core command to manage your post – i.e : creating, listing, editing, updating, etc.

  1. Create a new post

$ wp post create ./source-file.txt –post_category=105 –post_title=”You title”

2. List existing draft

$ wp post list –post_type=”draft”

3.Edit an existing draft

$wp post edit 1443

which will edit the given post (in VI – if vim is your default editor) – and then when you just escape – save exit – it will auto publish the new version.

That’s basically it.

 

Now – further development are about combining this tool with a similar tool – producing text – like Notional Velocity (Mac) or Terminal Velocity (Linux/Unix) – SimpleNote (Windows/Mac/Linux). and adding some extra commanding line tooling for image preview and image upload for which we could use tranfer.sh maybe…

 

That is really all there is to it – but I just to share cause i was excited about this whole set up.