Guides
Guides

Command Line Interface

Installation

📘

Requires NPM

To run PerfLint, you must have npm installed.

To install the PerfLint CLI from the npm repository, run the following;

npm install -g perflint

Usage

📘

Obtaining a WebPageTest API key

To obtain an API key for WebPageTest, you will need to follow the steps at 'Request WebPageTest API key'.

perflint -u http://example.com -k <WebPageTest API Key>

CLI Options

-u, --URL [url::String]

Specify the URL to lint — required (if not specified in config)

-k, --key [String]

📘

Also available as ENV variable

If you are running PerfLint in a CI environment it is not recommend keys are publically visible, therefore you can set the WebPageTest API key via process.env.PERFLINT_KEY. This removes the need for this option in the CLI.

Specify the WebPageTest API key — required (if not specified in config or ENV)

-c, --config [path::String]

Use configuration from this file or path — default: Current working directory

perflint -u http://example.com -k <WebPageTest API Key> -c ~/some/path/.perflintrc

-t, --timeout [Int]

Define duration before timeout when obtaining results (seconds) — default: 120

perflint -u http://example.com -k <WebPageTest API Key> -t 200

-f, --format [String]

Define output format — default: stylish

perflint -u http://example.com -k <WebPageTest API Key> -f stylish

-w, --maxWarnings [Int]

Number of warnings to trigger nonzero exit code — default: -1

perflint -u http://example.com -k <WebPageTest API Key> -w 10

-s, --server [String]

📘

Also available as ENV variable

You can set the WebPageTest Server URL via process.env.PERFLINT_SERVER. This removes the need for this option in the CLI.

Define the WebPageTest server URL — default: www.webpagetest.org

perflint -u http://example.com -k <WebPageTest API Key> -s my.customwptserver.com

--test [String]

❗️

Must be a valid WebPageTest ID.

📘

This removes the need to specify a URL.

Will run checks against existing WebPageTest results

perflint --test 160301_S3_1F0H -k <WebPageTest API Key>

-i, --info

If set displays test information on completion.

perflint -u http://example.com -k <WebPageTest API Key> -i
1020

Example information output

-v, --version

Display the current version

perflint --version

-h, --help

Display help and usage details

perflint --help