welaika / wp-cli-db2utf8

wp-cli command to downgrade db encoding of new WP installation to UTF8
MIT License
10 stars 1 forks source link

What did you think about the process of writing a command? #1

Open danielbachhuber opened 7 years ago

danielbachhuber commented 7 years ago

What went well, and what could be improved? Any documentation changes you'd suggest?

alessandro-fazzi commented 7 years ago

Hi @danielbachhuber ,

thanks for enquiring me about the process :)

I think the creation of a command is a quite simple process. In less then 6 hours I wen't through searching info to have a working command. Said that PHP is not my first nor favourite language, I think it sounds good.

Some notes a can leave about my experience

Split the cookbook

The cookbook contains a lot of info. And that's cool. I found anyway a bit difficult the fruition on a single page. Contents would be clearer if they'd be less per page, imho.

A more opinionated DSL to write commands

We have 4 different ways to write a command. I think we should have 1 way to write stand alone commands and another 1 to write a domain with subcommands. More opinionated. I can't - and probably it's just my fault - understand the need to have the chance to write a function or a class with the __invoke() magic method. The latter should be enough - because generally more ordered and flexible than the first.

I've perceived confusion reading a single code block with all the 4 ways inside of it. I read it 5 times at least. :P

Syntax highlighting

Why not to introduce syntax highlighting in the docs? :)

The scaffold command

It's an essential tool! It lowers a lot the learning curve! Great work!

Tests

Me and my colleagues are great estimators of tests and moreover integration test and behaviour based writing style. But I'm feeling a bit abandoned here: I don't know behat, I don't know how to manage wp-cli fixtures, db seeds...and all the great circus of testing :P I'd like very much to have at least some examples. I will go and grab them from already published commands, but it could be useful to have them putted together on a specific section of the - splitted! - cookbook.

Private/non-indexed commands

I can't understand how composer works. So please forgive my ignorance, but I have to say: I'd loved to have the chance to install commands not listed on the index. Publishing on the index is cool for a lot of reasons: do not misunderstand me. But sometimes development team have too much specific needs to produce general purpose code. The package I've published has a really small audience potential for example. Moreover is often desirable for agencies and teams to implement workflows to be shared only across the internal team.


Thanks for the chance to give some feedback and for your super-appreciated work on wp-cli.

danielbachhuber commented 7 years ago

Hey @pioneerskies:

I think the creation of a command is a quite simple process. In less then 6 hours I wen't through searching info to have a working command. Said that PHP is not my first nor favourite language, I think it sounds good.

Glad to hear it was a pleasant process :)

The cookbook contains a lot of info. And that's cool. I found anyway a bit difficult the fruition on a single page. Contents would be clearer if they'd be less per page, imho.

Points taken. I was actually intentional about including all of the information on one page, so you could more easily search through the page for the results you were looking for. But, I'll keep your suggestion in mind.

We have 4 different ways to write a command. I think we should have 1 way to write stand alone commands and another 1 to write a domain with subcommands.

That actually used to be the case, but the option to use any callable was introduced in a more recent release.

Once you start writing a number of WP-CLI commands, I think you'll find the ability to register a closure as a command quite useful. If I'm just doing something quick, I don't want to spend the time to write out an entire class.

Why not to introduce syntax highlighting in the docs? :)

A matter of time and effort. I probably should get a website wishlist going somewhere.

It's an essential tool! It lowers a lot the learning curve! Great work!

Glad to hear :)

But I'm feeling a bit abandoned here: I don't know behat, I don't know how to manage wp-cli fixtures, db seeds...and all the great circus of testing :P I'd like very much to have at least some examples. I will go and grab them from already published commands, but it could be useful to have them putted together on a specific section of the - splitted! - cookbook.

Out of curiosity, did you see https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-tests ?

I can't understand how composer works. So please forgive my ignorance, but I have to say: I'd loved to have the chance to install commands not listed on the index. Publishing on the index is cool for a lot of reasons: do not misunderstand me. But sometimes development team have too much specific needs to produce general purpose code. The package I've published has a really small audience potential for example.

There are a couple issues I have in mind for supporting installing from private repos: