phrase / phrase-cli

CLI for the Phrase API
https://developers.phrase.com
MIT License
42 stars 6 forks source link

`Error: unknown flag: --query` to delete collection of keys #58

Closed happypoulp closed 3 years ago

happypoulp commented 3 years ago

Hello,

It looks like we should be able to delete a collection of keys via cli using the syntax described here: https://developers.phrase.com/api/#delete-/projects/{project_id}/keys (for Cli v2):

phrase keys delete \
--project_id <project_id> \
--branch my-feature-branch \
--query 'mykey* translated:true' \
--locale_id abcd1234abcd1234abcd1234abcd1234 \
--access_token <token>

but when using it I get this error:

Error: unknown flag: --query

Usage:
  phrase keys delete [flags]

Flags:
      --branch string             specify the branch to use
  -h, --help                      help for delete
      --id string                 ID
      --project_id string         Project ID
      --x_phrase_app_otp string   Two-Factor-Authentication token (optional)

Global Flags:
  -t, --access_token string   access token used for authentication
      --config string         config file (default is ./.phrase.yml fallback to $HOME/.phrase.yml)
      --host string           Host to send Request to
      --tfa                   use Two-Factor Authentication
  -u, --username string       username used for authentication
  -v, --verbose               show more messages

The query flag is not mentioned as a valid one in the usage help text that the CLI prints.

Is it still possible / allowed to delete keys using a pattern like --query 'mykey* ? If not, how can I delete a collection of keys?

Note that I am using latest Cli version 2.0.20.

Thanks!

theSoenke commented 3 years ago

Hi @happypoulp, thanks for reporting this. We're currently investigating why this does not work. I'll keep you updated here

GMetaxakis commented 3 years ago

on my tries in keys list the --query couldn't work but the --q works if that helps

sbruhns commented 3 years ago

Hi @happypoulp, we released a new client version(https://github.com/phrase/phrase-cli/releases/tag/2.0.27) that supports batch actions like deleting multiple keys by --query. The problem was that 2 actions were mapped to the same command. This is now changed and you can use phrase keys delete-collection

phrase keys
Keys API

Usage:
  phrase keys [command]

Available Commands:
  create            Create a key
  delete            Delete a key
  delete-collection Delete collection of keys
  list              List keys
  search            Search keys
  show              Get a single key
  tag               Add tags to collection of keys
  untag             Remove tags from collection of keys
  update            Update a key
happypoulp commented 3 years ago

Wonderful, thanks!