algolia / cli

🔍 Algolia’s official CLI devtool
https://www.algolia.com/doc/tools/cli
MIT License
103 stars 26 forks source link

`rules browse --help` example includes unknown json option #151

Closed jsonmorris closed 6 months ago

jsonmorris commented 6 months ago

overview

It looks like the help output for rules browse contains an outdated example. The documentation for the -o output option provides a viable alternative, but the CLI help and the website docs are misleading.

reproducable example

$ algolia --profile dev rules browse dev --help
List all the rules of an index

Usage:
  algolia rules browse <index> [flags]

Flags:
  -h, --help   help for browse

Output Formatting Flags
      --allow-missing-template-keys   If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
  -o, --output string                 Output format. One of: (json, jsonpath, jsonpath-as-json, jsonpath-file). (default "json")
      --template string               Template string or path to template file to use when --output=jsonpath, --output=jsonpath-file.

Inherited Flags
      --api-key string          The API key
      --application-id string   The application ID
  -p, --profile string          The profile to use
      --search-hosts strings    The list of search hosts as CSV

Examples
  # List all the rules of the "MOVIES" index
  $ algolia rules browse MOVIES

  # List all the rules of the "MOVIES" index and save them to a 'rules.ndjson' file
  $ algolia rules browse MOVIES --json > rules.ndjson

Learn More
  Use 'algolia <command> <subcommand> --help' for more information about a command.
  Read the documentation at https://algolia.com/doc/tools/cli/

$ algolia --profile dev rules browse dev --json > rules/dev.ndjson
unknown flag: --json

expected behavior

Either --json works as described, or the example is replaced with one of the existing -o options.

clemfromspace commented 6 months ago

@jsonmorris Thanks for the detailed issue, the command example is indeed misleading.