fast-cli
Version:
Test your download and upload speed using fast.com
51 lines (47 loc) • 1.31 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import meow from 'meow';
import { render } from 'ink';
import Ui from './ui.js';
const cli = meow(`
Usage
$ fast
$ fast > file
Options
--upload, -u Measure upload speed in addition to download speed
--single-line Reduce spacing and output to a single line
--json JSON output
--verbose Include latency and server location information
Examples
$ fast --upload > file && cat file
17 Mbps
4.4 Mbps
$ fast --upload --json
`, {
importMeta: import.meta,
flags: {
upload: {
type: 'boolean',
shortFlag: 'u',
},
singleLine: {
type: 'boolean',
},
json: {
type: 'boolean',
},
verbose: {
type: 'boolean',
},
},
});
const App = () => (_jsx(Ui, { singleLine: cli.flags.singleLine, upload: cli.flags.upload || cli.flags.verbose, json: cli.flags.json, verbose: cli.flags.verbose }));
async function main() {
const app = render(_jsx(App, {}));
await app.waitUntilExit();
}
// It cannot use top-level await as that errors with some React error.
// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch((error) => {
console.error(error);
});