├── .gitignore ├── .gitattributes ├── .travis.yml ├── .editorconfig ├── test.js ├── cli.js ├── README.md ├── package.json └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 'stable' 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{package.json,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import childProcess from 'child_process'; 2 | import test from 'ava'; 3 | import pify from 'pify'; 4 | import fs from 'fs'; 5 | 6 | test(async t => { 7 | await pify(childProcess.execFile)('./cli.js', ['sindresorhus@gmail.com'], {cwd: __dirname}); 8 | 9 | t.ok(fs.statSync('sindresorhus@gmail.com.png')); 10 | }); 11 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | const fs = require('fs'); 4 | const meow = require('meow'); 5 | const getGravatar = require('get-gravatar'); 6 | 7 | const cli = meow(` 8 | Usage 9 | $ get-gravatar 10 | 11 | Options 12 | --size Size of the image. [Default: 80] 13 | --default Image to return if the email didn\'t match any Gravatar profile. 14 | --rating Allowed rating of the image. [Default: g] 15 | 16 | Examples 17 | $ get-gravatar sindresorhus@gmail.com 18 | `); 19 | 20 | if (cli.input.length === 0) { 21 | console.error('Email required'); 22 | process.exit(1); 23 | } 24 | 25 | getGravatar(cli.input[0], cli.flags).then(image => { 26 | fs.writeFileSync(`${cli.input[0]}.png`, image); 27 | process.exit(0); 28 | }); 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # get-gravatar-cli [![Build Status](https://travis-ci.org/SamVerschueren/get-gravatar-cli.svg?branch=master)](https://travis-ci.org/SamVerschueren/get-gravatar-cli) 2 | 3 | > Get a Gravatar image 4 | 5 | 6 | ## Install 7 | 8 | ``` 9 | $ npm install --global get-gravatar-cli 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ``` 16 | $ get-gravatar --help 17 | 18 | Usage 19 | $ get-gravatar 20 | 21 | Options 22 | --size Size of the image. [Default: 80] 23 | --default Image to return if the email didn't match any Gravatar profile. 24 | --rating Allowed rating of the image. [Default: g] 25 | 26 | Examples 27 | $ get-gravatar sindresorhus@gmail.com 28 | ``` 29 | 30 | 31 | ## Related 32 | 33 | - [get-gravatar](https://github.com/sindresorhus/get-gravatar) - API for this module 34 | 35 | 36 | ## License 37 | 38 | MIT © [Sam Verschueren](http://github.com/SamVerschueren) 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-gravatar-cli", 3 | "version": "1.0.1", 4 | "description": "Get a Gravatar image", 5 | "license": "MIT", 6 | "repository": "SamVerschueren/get-gravatar-cli", 7 | "author": { 8 | "name": "Sam Verschueren", 9 | "email": "sam.verschueren@gmail.com", 10 | "url": "github.com/SamVerschueren" 11 | }, 12 | "bin": { 13 | "get-gravatar": "cli.js" 14 | }, 15 | "engines": { 16 | "node": ">=4" 17 | }, 18 | "scripts": { 19 | "test": "xo && ava" 20 | }, 21 | "files": [ 22 | "cli.js" 23 | ], 24 | "keywords": [ 25 | "cli-app", 26 | "cli", 27 | "get-gravatar", 28 | "gravatar" 29 | ], 30 | "dependencies": { 31 | "get-gravatar": "^2.0.0", 32 | "meow": "^3.4.2" 33 | }, 34 | "devDependencies": { 35 | "ava": "*", 36 | "pify": "^2.2.0", 37 | "xo": "*" 38 | }, 39 | "xo": { 40 | "esnext": true 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sam Verschueren (github.com/SamVerschueren) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | --------------------------------------------------------------------------------