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

Line breaks in meta values break wp post meta list #262

Open
johnbillion opened this issue Aug 7, 2019 · 1 comment
Open

Line breaks in meta values break wp post meta list #262

johnbillion opened this issue Aug 7, 2019 · 1 comment

Comments

@johnbillion
Copy link
Contributor

Given a post meta field with a value that contains line breaks, the output of wp post meta list breaks. Example:

$ wp post meta list 123
+---------+----------+------------+
| post_id | meta_key | meta_value |
+---------+----------+------------+
| 123     | foo      | foo        |
| 123     | bar      | bar
bar
bar
bar
bar
bar |
| 123     | baz      | baz        |
+---------+----------+------------+

Should this output be improved? A potential improvement would be:

+---------+----------+------------+
| post_id | meta_key | meta_value |
+---------+----------+------------+
| 123     | foo      | foo        |
| 123     | bar      | bar        |
|         |          | bar        |
|         |          | bar        |
|         |          | bar        |
|         |          | bar        |
| 123     | baz      | baz        |
+---------+----------+------------+

This might be difficult to implement though.

Note: The wp post get command doesn't suffer from this problem, which means line breaks in the post_content field don't break the output.

@tfirdaus
Copy link

tfirdaus commented Apr 9, 2024

@schlessera I was able to replicate this issue:

001 Scenario: List post meta with line break value   # features/post-meta.feature:492
      Then STDOUT should be a table containing rows: # features/post-meta.feature:503
        post_id meta_key        meta_value
        1       foo     bar
        bar
        bar
         (Exception)

But looks like we're facing a similar issue with the post list command as well.

Screenshot 2024-04-09 at 4 51 40 PM

The output changes depending on the window size though, and it seems like the line break is simply replaced with a blank space? 🤔

Screenshot 2024-04-09 at 4 54 18 PM

Handling the line break might be difficult, as @johnbillion mentioned. However, we could probably consider making a compromise by replacing the line break with a blank space in the table format. I haven't checked the JSON and YML formats, but I believe retaining the line break in those two formats would be much simpler.

What's your thought?

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

3 participants