ideas icon indicating copy to clipboard operation
ideas copied to clipboard

How-to command

Open schlessera opened this issue 8 years ago • 2 comments

A wp howto command would be great, to discover how to go about solving a specific problem.

So, basically, what I would like to see is a "how-to" command: wp howto <phrase>.

Someone that tries to get a list of the latest posts would then start by typing wp howto get latest posts.

The way I imagine this to work is to provide a basic thesaurus (with synonyms), and then do a fuzzy search (including synonyms) against short descriptions, long descriptions and examples.

To keep the file size in check, I'd like to use the WordNet synonyms database, and strip all words that are not part of either the WP-CLI codebase or the Simplified English Specification.

This should then result in a synonyms database that contains the union of the simplified english and the WP-CLI technical terms.

The main benefit I see is that the examples in the documentation become hugely valuable, because searches will often land on these examples and immediately show usable code.

The more examples we add, the more useful the howto command becomes.

I think this might help new users better discover how to go about solving their problems and using WP-CLI effectively.

schlessera avatar Sep 05 '17 16:09 schlessera

This is a neat feature of Homebrew: if a tap doesn't exist, it shows pull requests that might be relevant:

image

danielbachhuber avatar Feb 20 '18 16:02 danielbachhuber

Perhaps something like cheat.sh (http://cheat.sh/) which uses curl to respond with a short sensible man page, for instance

curl cheat.sh/tee

gives their short and sensible man page to the 'tee' command.

If there was a similar site for wp-cli commands from which users can get responses to a command line query like

curl wp-cli.sh/page

it could, if properly formatted, return snippets, a full man page, examples, crossover instructions. A modular approach would allow anything about wp-cli interacting with pages to be returned, at varying levels of inclusion.

I see it as two parts: compose the existing instructions into bite-sized pieces, and create the db queries to return responses.

A request might look like this:

curl wp-cli.sh/page

to return the basic how-to info. Or like this

curl wp-cli.sh/page/c

to return complete information, every modular bit that uses the term page (meaning the modules need to be tight and clean.)

Could include options like /e for examples, /a or /o for arguments or options.

If this isn't likely to gain traction here in the official wp-cli arena, it's the kind of project I'd take on myself now that I'm retired, but can't stop playing with WordPress and wp-cli.

joeldcanfield avatar Nov 20 '22 19:11 joeldcanfield