├── index.js ├── package.json ├── happy-birthday.js ├── README.md ├── .gitignore ├── LICENSE └── messages.txt /index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var path = require('path') 3 | var messages = fs.readFileSync(path.join(__dirname, 'messages.txt'), 'utf8').split('\n') 4 | 5 | module.exports = function (name) { 6 | var num = Math.floor(Math.random() * (messages.length - 1)) 7 | var message = messages[num] 8 | message = message.replace('$1', name) 9 | return message 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "happy-birthday", 3 | "version": "0.23.0", 4 | "description": "Happy birthday to you!", 5 | "main": "index.js", 6 | "bin": { 7 | "happy-birthday": "./happy-birthday.js" 8 | }, 9 | "dependencies": { 10 | "commander": "^2.9.0" 11 | }, 12 | "devDependencies": {}, 13 | "scripts": { 14 | "test": "echo \"Error: no test specified\" && exit 1" 15 | }, 16 | "author": "Daijiro Wachi", 17 | "license": "MIT" 18 | } 19 | -------------------------------------------------------------------------------- /happy-birthday.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var program = require('commander') 3 | var hb = require('./') 4 | var pkg = require('./package.json') 5 | var message = you = '' 6 | 7 | program 8 | .version(pkg.version) 9 | .usage('-u name') 10 | .option('-u, --you [name]', 'Name') 11 | .parse(process.argv) 12 | 13 | if (!program.you) return program.help() 14 | 15 | you = program.you 16 | message = hb(you) 17 | 18 | console.log('\n') 19 | console.log(message) 20 | console.log('\n') 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # happy-birthday 2 | to you! 3 | 4 | ## Usage 5 | ``` 6 | Usage: happy-birthday -u name 7 | 8 | Options: 9 | 10 | -h, --help output usage information 11 | -V, --version output the version number 12 | -u, --you [name] Name 13 | ``` 14 | 15 | ## Install 16 | ``` 17 | $ npm install -g happy-birthday 18 | $ happy-birthday --version 19 | 0.3.0 20 | ``` 21 | 22 | ## Patch welcome 23 | Add your message ;) 24 | https://github.com/watilde/happy-birthday/blob/master/messages.txt 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | # happy-birthday 36 | .dat 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Daijiro Wachi 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /messages.txt: -------------------------------------------------------------------------------- 1 | Happy birthday, $1! 2 | Feliz aniversário, $1! 3 | Joyeux anniversaire, $1! 4 | Feliz cumpleaños, $1! 5 | お誕生日おめでとう、$1! 6 | Alles Gute zum Geburtstag, $1! 7 | Per molts anys, $1! 8 | 생일 축하해, $1! 9 | С Днём рождения, $1! 10 | З Днем народження, $1! 11 | Maligayang bati, $1! 12 | Grattis på födelsedagen, $1! 13 | Boldog szülinapot, $1! 14 | Sretan ti rođendan, $1! 15 | 生日快乐, $1! 16 | 生日快樂, $1! 17 | സന്തോഷ ജന്മദിനം $1കു 18 | Selamat ulang tahun, $1! 19 | Sugeng ambal warso, $1! 20 | Buon compleanno, $1! 21 | Fijne verjaardag, $1! 22 | Chúc mừng sinh nhật, $1! 23 | పుట్టినరోజు శుభాకాంక్షలు $1! 24 | ಜನ್ಮದಿನದ ಶುಭಾಶಯಗಳು $1! 25 | जन्मदिन की शुभकामनाएं $1! 26 | สุขสันต์วันเกิด $1! 27 | Wszystkiego najlepszego, $1! 28 | La mulți ani, $1! 29 | تولدت مبارک, $1! 30 | वाढदिवसाच्या शुभेच्छा $1! 31 | ಹುಟ್ಟುಹಬ್ಬದ ಶುಭಾಶಯಗಳು $1! 32 | Feliĉan naskiĝtagon, $1! 33 | Arahabaina nahatratra ny nitsingerenan'ny taona nahaterahanao ianao $1! 34 | Төрсөн өдрийн мэнд хүргэе, $1! 35 | سالگرہ مبارک، $1 36 | இனிய பிறந்தநாள் வாழ்த்துக்கள் $1! 37 | Doğum günün kutlu olsun, $1! 38 | Mutlu yillar, $1! 39 | Gratulerer med dagen, $1! 40 | සුබ උපන්දිනයක් වේවා, $1! 41 | كل سنة و انت طيب يا $1! 42 | जीवेत् शरद: शतम् $1 ! 43 | Sngi kha ba suk, $1! 44 | መልካም ልደት $1 ! 45 | Tavallud ayyomingiz muborak bo'lsin $1! 46 | Všetko najlepšie, $1! 47 | Všechno nejlepší, $1! 48 | გილოცავ დაბადების დღეს, $1! 49 | Aues Guete zum Geburtstag, $1! 50 | --------------------------------------------------------------------------------