Skip to content

HTTP Tracker client: Add option to show response in pretty JSON #1562

@josecelano

Description

@josecelano

Parent issue: #669
Relates to: #1563

I usually pipe the client output through the console command "jq" to format the JSON response into a more readable format. It would be nice to add an option to do it without requiring an external command:

cargo run -p torrust-tracker-client --bin http_tracker_client announce https://tracker.torrust-demo.com 000620bbc6c52d5a96d98f6c0f1dfa523a40df82 | jq
{
  "complete": 2,
  "incomplete": 0,
  "interval": 300,
  "min interval": 300,
  "peers": [
    {
      "ip": "185.53.146.66",
      "peer id": [
        45,
        113,
        66,
        52,
        51,
        57,
        48,
        45,
        108,
        120,
        99,
        74,
        46,
        97,
        50,
        72,
        79,
        106,
        85,
        86
      ],
      "port": 45809
    }
  ]
}

The new command option could be format:

cargo run -p torrust-tracker-client --bin http_tracker_client announce https://tracker.torrust-demo.com 000620bbc6c52d5a96d98f6c0f1dfa523a40df82 --format pretty

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions