Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "airbnb-base",
"rules": {
"comma-dangle": 0
"comma-dangle": 0,
"no-console": "off"
}
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ isitup('github.com').then(data => {
});
```

## Command line usage
Install it with `-g` flag:
```bash
npm install -g isitup
```
and in terminal type:
```bash
isitup github.com
```
and see help page with `isitup --help`.

## Tests

Expand Down
32 changes: 32 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const isitup = require('.');
const meow = require('meow');
const chalk = require('chalk');

const log = console.log;

const cli = meow(`
Usage:
$ isitup <website>

Examples:
$ isitup github.com
`);

// If url not set, show help and exit.
if (cli.input[0] === undefined) {
cli.showHelp();
}

isitup(cli.input[0]).then(data => {
let output = `domain: ${chalk.green(data.domain)}\n`;
output += `port: ${chalk.green(data.port)}\n`;
output += `status code: ${chalk.green(data.status_code)}\n`;
output += `response ip: ${chalk.green(data.response_ip)}\n`;
output += `response code: ${chalk.green(data.response_code)}\n`;
output += `response time: ${chalk.green(data.response_time)}`;
log(output);
}).catch(err => {
log(err);
});
Loading