{"_id":"56fbe112698bea2b00de70c7","project":"56d60e96b939870b00512bf3","user":"542975351215fe08007e0e85","version":{"_id":"56fbe112698bea2b00de70c2","hasDoc":true,"project":"56d60e96b939870b00512bf3","hasReference":true,"__v":1,"createdAt":"2016-03-30T14:22:10.357Z","releaseDate":"2016-03-30T14:22:10.357Z","categories":["56fbe112698bea2b00de70c3","56fbe112698bea2b00de70c4"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.5","version":"0.0.5"},"category":{"_id":"56fbe112698bea2b00de70c3","__v":0,"version":"56fbe112698bea2b00de70c2","project":"56d60e96b939870b00512bf3","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-01T21:50:15.983Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"__v":2,"githubsync":"","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-01T22:04:19.151Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Installation\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"To run PerfLint, you must have [npm](https://www.npmjs.com/) installed.\",\n  \"title\": \"Requires NPM\"\n}\n[/block]\n\nTo install the PerfLint CLI from the `npm` repository, run the following;\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"npm install -g perflint\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Usage\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Obtaining a WebPageTest API key\",\n  \"body\": \"To obtain an API key for WebPageTest, you will need to follow the steps at '[Request WebPageTest API key](http://www.webpagetest.org/getkey.php)'.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key>\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CLI Options\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-u, --URL [url::String]\"\n}\n[/block]\nSpecify the URL to lint — _**required** (if not specified in config)_\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-k, --key [String]\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Also available as ENV variable\",\n  \"body\": \"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.\"\n}\n[/block]\nSpecify the WebPageTest API key — _**required** (if not specified in config or ENV)_ \n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-c, --config [path::String]\"\n}\n[/block]\nUse configuration from this file or path — _**default:** Current working directory_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -c ~/some/path/.perflintrc\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-t, --timeout [Int]\"\n}\n[/block]\nDefine duration before timeout when obtaining results (seconds) — _**default:** 120_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -t 200\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-f, --format [String]\"\n}\n[/block]\nDefine output format — _**default:** stylish_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -f stylish\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-w, --maxWarnings [Int]\"\n}\n[/block]\nNumber of warnings to trigger nonzero exit code — _**default:** -1_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -w 10\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-s, --server [String]\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Also available as ENV variable\",\n  \"body\": \"You can set the WebPageTest Server URL via `process.env.PERFLINT_SERVER`. This removes the need for this option in the CLI.\"\n}\n[/block]\nDefine the WebPageTest server URL — _**default:** www.webpagetest.org_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -s my.customwptserver.com\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"--test [String]\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"body\": \"Must be a valid WebPageTest ID.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"This removes the need to specify a URL.\",\n  \"title\": \"\"\n}\n[/block]\nWill run checks against existing WebPageTest results\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint --test 160301_S3_1F0H -k <WebPageTest API Key>\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-i, --info\"\n}\n[/block]\nIf set displays test information on completion.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint -u http://example.com -k <WebPageTest API Key> -i\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/gdK8NONfT5bkThHGkYRw_Screen%20Shot%202016-03-11%20at%2010.33.32.png\",\n        \"Screen Shot 2016-03-11 at 10.33.32.png\",\n        \"1020\",\n        \"239\",\n        \"#734d38\",\n        \"\"\n      ],\n      \"caption\": \"Example information output\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-v, --version\"\n}\n[/block]\nDisplay the current version\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint --version\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"options\",\n  \"title\": \"-h, --help\"\n}\n[/block]\nDisplay help and usage details\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"perflint --help\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"command-line-interface","type":"basic","title":"Command Line Interface"}

Command Line Interface


[block:api-header] { "type": "basic", "title": "Installation" } [/block] [block:callout] { "type": "info", "body": "To run PerfLint, you must have [npm](https://www.npmjs.com/) installed.", "title": "Requires NPM" } [/block] To install the PerfLint CLI from the `npm` repository, run the following; [block:code] { "codes": [ { "code": "npm install -g perflint", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "Usage" } [/block] [block:callout] { "type": "info", "title": "Obtaining a WebPageTest API key", "body": "To obtain an API key for WebPageTest, you will need to follow the steps at '[Request WebPageTest API key](http://www.webpagetest.org/getkey.php)'." } [/block] [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key>", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "CLI Options" } [/block] [block:api-header] { "type": "options", "title": "-u, --URL [url::String]" } [/block] Specify the URL to lint — _**required** (if not specified in config)_ [block:api-header] { "type": "options", "title": "-k, --key [String]" } [/block] [block:callout] { "type": "info", "title": "Also available as ENV variable", "body": "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." } [/block] Specify the WebPageTest API key — _**required** (if not specified in config or ENV)_ [block:api-header] { "type": "options", "title": "-c, --config [path::String]" } [/block] Use configuration from this file or path — _**default:** Current working directory_ [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -c ~/some/path/.perflintrc", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-t, --timeout [Int]" } [/block] Define duration before timeout when obtaining results (seconds) — _**default:** 120_ [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -t 200", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-f, --format [String]" } [/block] Define output format — _**default:** stylish_ [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -f stylish", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-w, --maxWarnings [Int]" } [/block] Number of warnings to trigger nonzero exit code — _**default:** -1_ [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -w 10", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-s, --server [String]" } [/block] [block:callout] { "type": "info", "title": "Also available as ENV variable", "body": "You can set the WebPageTest Server URL via `process.env.PERFLINT_SERVER`. This removes the need for this option in the CLI." } [/block] Define the WebPageTest server URL — _**default:** www.webpagetest.org_ [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -s my.customwptserver.com", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "--test [String]" } [/block] [block:callout] { "type": "danger", "body": "Must be a valid WebPageTest ID." } [/block] [block:callout] { "type": "info", "body": "This removes the need to specify a URL.", "title": "" } [/block] Will run checks against existing WebPageTest results [block:code] { "codes": [ { "code": "perflint --test 160301_S3_1F0H -k <WebPageTest API Key>", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-i, --info" } [/block] If set displays test information on completion. [block:code] { "codes": [ { "code": "perflint -u http://example.com -k <WebPageTest API Key> -i", "language": "text" } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/gdK8NONfT5bkThHGkYRw_Screen%20Shot%202016-03-11%20at%2010.33.32.png", "Screen Shot 2016-03-11 at 10.33.32.png", "1020", "239", "#734d38", "" ], "caption": "Example information output" } ] } [/block] [block:api-header] { "type": "options", "title": "-v, --version" } [/block] Display the current version [block:code] { "codes": [ { "code": "perflint --version", "language": "shell" } ] } [/block] [block:api-header] { "type": "options", "title": "-h, --help" } [/block] Display help and usage details [block:code] { "codes": [ { "code": "perflint --help", "language": "shell" } ] } [/block]