diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..f6a43f9 --- /dev/null +++ b/.npmignore @@ -0,0 +1,7 @@ +node_modules +screenshot_* +.editorconfig +.eslintrc.json +.gitattributes +.travis.yml +_config.yml diff --git a/README.md b/README.md index 6ea279c..6ca85b3 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,8 @@ $ getmyip -V, --version output the version number ``` -
- -
+ + ## License diff --git a/index.js b/index.js index 82833aa..f831e64 100755 --- a/index.js +++ b/index.js @@ -4,13 +4,6 @@ const fetch = require('node-fetch'); const program = require('commander'); const pkg = require('./package.json'); -program - .version(pkg.version) - .description('`getmyip` command prints your current IP') - .usage('[options]') - .option('-v, --verbose', 'Show more details') - .parse(process.argv); - const URL = 'http://ipinfo.io'; const OPTIONS = { headers: { @@ -18,11 +11,6 @@ const OPTIONS = { } }; -function objToStr(obj) { - const keyval = Object.keys(obj).map(key => `${key}\t: ${obj[key]}`); - return keyval.join('\n'); -} - function ProcessVerboseResponse(response) { const res = { ip: response.ip, @@ -36,6 +24,18 @@ function ProcessVerboseResponse(response) { return objToStr(res); } +function objToStr(obj) { + const keyval = Object.keys(obj).map(key => `${key}\t: ${obj[key]}`); + return keyval.join('\n'); +} + +program + .version(pkg.version) + .description('`getmyip` command prints your current IP') + .usage('[options]') + .option('-v, --verbose', 'Show more details') + .parse(process.argv); + fetch(URL, OPTIONS) .then(res => res.json()) .then(response => { diff --git a/screenshot_getmyip.png b/screenshot_getmyip.png index 9249a09..dbc153d 100644 Binary files a/screenshot_getmyip.png and b/screenshot_getmyip.png differ