Skip to content

Fix/report improvements#55

Closed
LC43 wants to merge 7 commits intowp-cli:masterfrom
LC43:fix/report-improvements
Closed

Fix/report improvements#55
LC43 wants to merge 7 commits intowp-cli:masterfrom
LC43:fix/report-improvements

Conversation

@LC43
Copy link
Contributor

@LC43 LC43 commented Dec 8, 2017

Hi, i had this stalled waiting for a reply on slack :$

I think this condition for the report being printed is more complete.

@danielbachhuber
Copy link
Member

@LC43 Can you merge master please?

@gitlost Can you make a judgement on this when you have a moment?

@LC43
Copy link
Contributor Author

LC43 commented Dec 8, 2017

Hi @danielbachhuber, done.

i would like to discuss that, since --report is true by default, when doing if ( $this->report ) is not enough, because if you pass --report=false is still seen as true ( false is passed as a string ).

Thanks why i used it separately:

if ( $this->report_changed_only ) {
	continue;
}

there's another places where the if ( $this->report ) condition is made.

If i'm not wrong, i think doing if ( true == $this->report ) { would be the correct way to treat this or change the parsing of false parameters?

Also, in order to prevent empty tables, i added

if ( $this->report && ! empty( $report ) ) {

@gitlost
Copy link
Contributor

gitlost commented Dec 8, 2017

Thanks for the PR @LC43.

Re not outputting a warning if report_changed_only set then the behaviour here is probably more what people wanted from #54, so b69fb96 looks good to me. A functional test would be nice though.

Re the flag issue I don't see this as necessary. Doing --report=false is not currently supported as a way to set a flag to false. If we want to support that (and it may be a good idea to) then it should be done at the framework level.

@LC43
Copy link
Contributor Author

LC43 commented Dec 8, 2017

thanks for the review @gitlost .

i'll close this one and add a new with b69fb96 . but can i keep the 2adf235 too ?

@gitlost
Copy link
Contributor

gitlost commented Dec 8, 2017

i'll close this one and add a new

If that's handier for you @LC43, though you could just use this one.

can i keep the 2adf235 too

Sorry missed that - not printing any report if there's nothing to report looks like desired behaviour to me, though technically it's not BC. I can't see it causing issues for scripts so it's probably cool, @danielbachhuber ? Again a functional test for this behaviour would be good.

@danielbachhuber
Copy link
Member

Sorry missed that - not printing any report if there's nothing to report looks like desired behaviour to me, though technically it's not BC.

Just to take a step back, in what usage scenarios would this be the case?

@gitlost
Copy link
Contributor

gitlost commented Dec 8, 2017

It's if the search doesn't match anything. So given

vendor/bin/wp --path=/var/www/wptest search-replace not_found dummy --report-changed-only

without the ! empty( $report ) check you currently get an empty table:

+-------+--------+--------------+------+
| Table | Column | Replacements | Type |
+-------+--------+--------------+------+
+-------+--------+--------------+------+
Success: 0 replacements to be made.

With the ! empty( $report ) check 2adf235 you don't get an empty table, just:

Success: 0 replacements to be made.

@danielbachhuber
Copy link
Member

Ok, works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants