torrust-tracker
torrust-tracker copied to clipboard
UDP Tracker client: Add option to show response in pretty JSON
Parent issue: https://github.com/torrust/torrust-tracker/issues/669 Relates to: https://github.com/torrust/torrust-tracker/issues/1562
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 udp_tracker_client announce udp://tracker.torrust-demo.com:6969/announce 000620bbc6c52d5a96d98f6c0f1dfa523a40df82 | jq
{
"AnnounceIpv4": {
"transaction_id": -888840697,
"announce_interval": 300,
"leechers": 2,
"seeders": 7,
"peers": [
"2.137.108.79:34688",
"37.109.147.11:8443",
"86.42.165.70:8999",
"93.159.28.2:51413",
"185.72.186.215:51413",
"185.164.140.189:7990",
"188.146.16.204:6881",
"195.117.101.49:49512"
]
}
}
The new command option could be format:
cargo run -p torrust-tracker-client --bin udp_tracker_client announce udp://tracker.torrust-demo.com:6969/announce 000620bbc6c52d5a96d98f6c0f1dfa523a40df82 --format pretty