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

Remove yaml output format from --format flag. / Deprecate --format json in favor of --json #2587

Merged
merged 3 commits into from
May 3, 2024

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Apr 30, 2024

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

  • Removes the yaml option from the --format flag
  • Adds a --json flag that is equivalent to --format json
  • Hides --format xxxx flag from the help (but the flag is still functional)

What is the current behavior?

$ arduino-cli board list --format json -w
{
  "eventType": "add",
  "port": {
    "address": "/dev/ttyS4",
    "label": "/dev/ttyS4",
    "protocol": "serial",
    "protocol_label": "Serial Port",
    "properties": {}
  }
}
^C
$ arduino-cli board list --format yaml -w
eventType: add              <---- this is an invalid YAML stream
port:
  address: /dev/ttyS4
  label: /dev/ttyS4
  properties: {}
  protocol: serial
  protocol_label: Serial Port

^C

What is the new behavior?

$ arduino-cli board list --format json -w
{
  "eventType": "add",
  "port": {
    "address": "/dev/ttyS4",
    "label": "/dev/ttyS4",
    "protocol": "serial",
    "protocol_label": "Serial Port",
    "properties": {}
  }
}
^C
$ arduino-cli board list --format yaml -w
Invalid output format: yaml
$ arduino-cli board list --json
{
  "detected_ports": [
    {
      "port": {
        "address": "/dev/ttyS4",
        "label": "/dev/ttyS4",
        "protocol": "serial",
        "protocol_label": "Serial Port",
        "properties": {}
      }
    }
  ]
}
$ arduino-cli 
Arduino Command Line Interface (arduino-cli).

Usage:
  arduino-cli [command]

Examples:
  arduino-cli <command> [flags...]

Available Commands:
  board           Arduino board commands.
  burn-bootloader Upload the bootloader.
  cache           Arduino cache commands.
  compile         Compiles Arduino sketches.
  completion      Generates completion scripts
  config          Arduino configuration commands.
  core            Arduino core operations.
  daemon          Run as a daemon on port: 50051
  debug           Debug Arduino sketches.
  help            Help about any command
  lib             Arduino commands about libraries.
  monitor         Open a communication port with a board.
  outdated        Lists cores and libraries that can be upgraded
  sketch          Arduino CLI sketch commands.
  update          Updates the index of cores and libraries
  upgrade         Upgrades installed cores and libraries.
  upload          Upload Arduino sketches.
  version         Shows version number of Arduino CLI.

Flags:
      --additional-urls strings   Comma-separated list of additional URLs for the Boards Manager.
      --config-file string        The custom config file (if not specified the default will be used).
  -h, --help                      help for arduino-cli
      --json                      Print the output in JSON format.
      --log                       Print the logs on the standard output.
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.

Use "arduino-cli [command] --help" for more information about a command.

Does this PR introduce a breaking change, and is titled accordingly?

Yes

Other information

@cmaglie cmaglie self-assigned this Apr 30, 2024
@cmaglie cmaglie added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: CLI Related to the command line interface labels Apr 30, 2024
@cmaglie cmaglie linked an issue Apr 30, 2024 that may be closed by this pull request
3 tasks
@cmaglie cmaglie merged commit 2063b6a into arduino:master May 3, 2024
102 checks passed
@cmaglie cmaglie deleted the remove_yaml_output branch May 3, 2024 11:13
@per1234 per1234 mentioned this pull request Jun 12, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove support for --format yaml
2 participants