Automattic / team51-cli

A tool for provisioning and connecting GitHub repos, Pressable WordPress sites and DeployHQ.
MIT License
12 stars 0 forks source link

Allow output formatting for WooCommerce Stats command #178

Closed mdrovdahl closed 1 year ago

mdrovdahl commented 1 year ago

Noting @cagrimmett already started work on this in #175.

Ideally this (and ALL) subcommand(s) would allow for variably formatted output based on flags, similar to how wp-cli works:

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

As it stands, here's a snippet to strip the current table formatted output down to a more parseable output: team51 stats:woocommerce-orders --unit=month --date=2022-12 | grep -E '[a-z0-9]' | sed 's/\xe2\x95\x91//g; s/\xe2\x94\x82//g' From there you can use cut with the space delimiter to get at specific fields