Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't set with_attachments to FALSE #40

Closed
drzraf opened this issue Jul 12, 2018 · 5 comments
Closed

can't set with_attachments to FALSE #40

drzraf opened this issue Jul 12, 2018 · 5 comments

Comments

@drzraf
Copy link

drzraf commented Jul 12, 2018

Followup of #16
There was introduced --with_attachments. During the course of the PR, validation/casting disappeared and argument was handled that way:

+		$this->export_args['with_attachments'] = WP_CLI\Utils\get_flag_value(
+			$assoc_args,
+			'with_attachments',
+			$defaults['with_attachments']
+		);

But on the other side, the code test for boolean value.
== we can't force --with_attachment to FALSE whatever the value passed would be (=0, =no, =false, ...)

Ref to get_flag_value

drzraf pushed a commit to drzraf/export-command that referenced this issue Jul 12, 2018
drzraf pushed a commit to drzraf/export-command that referenced this issue Jul 12, 2018
@schlessera
Copy link
Member

schlessera commented Jul 13, 2018

@drzraf The way to negate a flag is to add no- in front of it:

--no-with_attachments

This is part of the default Synopsis handling of WP-CLI.

@schlessera
Copy link
Member

@drzraf Can you confirm this is what you were intending to do with this PR?

@drzraf
Copy link
Author

drzraf commented Jul 16, 2018

More or less. My main goal was to get it work in combination with --post_type.
I didn't remember about the "no-with" syntax (can't be more counter-intuitive), and intended to add support for argument value (--no-with_attachments didn't work previously in combination of --post_type)

@schlessera
Copy link
Member

I conclude that your current use case is solved and that I can close the current issue and corresponding pull-request.

@drzraf
Copy link
Author

drzraf commented Aug 6, 2018

I'd need to test this again, but this hunk: https://github.com/wp-cli/export-command/pull/41/files#diff-62b6f83678ae9c3aaa96e7b97dce0433R163
make possible to specify both post_type and NO attachments.

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

No branches or pull requests

2 participants