Closed seanmcne closed 3 years ago
I don't see the point of 2 JSON flags. Make it just --json
and pretty.
I don't see the point of 2 JSON flags. Make it just
--json
and pretty.
I assume there are some folks that want to use this in automation and logging and wouldn't want the extra spaces and tabs, whereas some may want it human readable (it's actually matching the options that speedtest.net has for their CLI).
My previous experience with a similar command line tool was for speedtest-cli - here is the command help output for that cli tool which is what I patterned json and json-pretty from:
Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.
Version: speedtest 1.0.0.2
Usage: speedtest [<options>]
-h, --help Print usage information
-V, --version Print version number
-L, --servers List nearest servers
-s, --server-id=# Specify a server from the server list using its id
-I, --interface=ARG Attempt to bind to the specified interface when connecting to servers
-i, --ip=ARG Attempt to bind to the specified IP address when connecting to servers
-o, --host=ARG Specify a server, from the server list, using its host's fully qualified domain name
-p, --progress=yes|no Enable or disable progress bar (Note: only available for 'human-readable'
or 'json' and defaults to yes when interactive)
-P, --precision=# Number of decimals to use (0-8, default=2)
-f, --format=ARG Output format (see below for valid formats)
-u, --unit[=ARG] Output unit for displaying speeds (Note: this is only applicable
for ‘human-readable’ output format and the default unit is Mbps)
-a Shortcut for [-u auto-decimal-bits]
-A Shortcut for [-u auto-decimal-bytes]
-b Shortcut for [-u auto-binary-bits]
-B Shortcut for [-u auto-binary-bytes]
--selection-details Show server selection details
-v Logging verbosity. Specify multiple times for higher verbosity
--output-header Show output header for CSV and TSV formats
Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty
Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision
Valid units for [-u] flag:
Decimal prefix, bits per second: bps, kbps, Mbps, Gbps
Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
Binary prefix, bits per second: kibps, Mibps, Gibps
Binary prefix, bytes per second: kiB/s, MiB/s, GiB/s
Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes
I assume there are some folks that want to use this in automation and logging and wouldn't want the extra spaces and tabs, whereas some may want it human-readable (it's actually matching the options that speedtest.net has for their CLI).
Logging is a good point. Let's only do the one-line version then. I don't really see the point of human-readable JSON output anyway, as we already have a nice output for humans. If someone needs a nice JSON output they can pipe the output through some JSON formatter.
My previous experience with a similar command line tool was for speedtest-cli - here is the command help output for that cli tool which is what I patterned json and json-pretty from:
I prefer to keep my CLIs minimal.
I assume there are some folks that want to use this in automation and logging and wouldn't want the extra spaces and tabs, whereas some may want it human-readable (it's actually matching the options that speedtest.net has for their CLI).
Logging is a good point. Let's only do the one-line version then. I don't really see the point of human-readable JSON output anyway, as we already have a nice output for humans. If someone needs a nice JSON output they can pipe the output through some JSON formatter.
Sounds good - I just adjusted cli.js. Let me know what you thank - thx!
@seanmcne I would recommend looking over your own diff after doing changes. I think you could have caught some of the things I commented yourself. 👍🏻
Closing in favor of #58
output examples (note: I used node directly to debug locally)
I also added several common properties on the fast.com webpage currently to help improve data captured.
for json human readable output
for json only output