Add new --meta_format to `wp post meta` commands

Đang mở
#142 10 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php, wordpress
Lĩnh vực
cli

Hướng nghiên cứu

Review the post meta list and post meta get command behavior and their documented --format options first. Resolve the proposed name for the key-value JSON format, then make both commands emit the format expected by the post create and post update meta_input examples and verify the documented command outputs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

command:post-meta-get command:post-meta-list

According to the WP-CLI 1.5.0 Announcement:

The --meta_input option of the post create and post update commands now accepts JSON-formatted arrays, so you can add or update your post and its meta in one go:

$ wp post create --post_title='Title' --post_content='Content.' --meta_input='{"key1":"value1","key2":"value2"}
Success: Created post 123.

Unfortunately, there doesn't seem to be an equivalent export option for post meta list or post meta get.

wp post meta list 123 --fields=meta_key,meta_value --format=json will create [{"meta_key":"foo", "meta_value":"bar}] and not {"foo":"bar"} as shown in the examples for post update and post create.


post meta list

[--format=<format>]
Accepted values: table, csv, json, count. Default: table

post meta get

[--format=<format>]
Accepted values: table, json. Default: table

[--format=<format>]
Render output in a particular format.
---
default: table
options:
– table
– csv
– ids
– json
– count
– yaml

A suggestion has been made to add a new --format=meta_input or similar.

While the argument meta_input makes sense to solve this particular issue (based on import) it doesn't really describe the export type which is <key>:<value> JSON.

  • --format=meta_input
  • --format=json-key-value
  • --format=json-key:value
  • --format=jsonkv
  • --format=json-kv
Ngôn ngữ chính
PHP
Star
105
Fork
97
Merge trung bình
2 giờ 1 phút
Pull request đã merge (30 ngày)
12

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wp-cli/entity-command

Tất cả issue của wp-cli/entity-command

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.