-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
test: | ||
@mocha -R spec tests/test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
var commander = require('commander'); | ||
//require('colors'); | ||
var pinyin = require("../src/pinyin"); | ||
|
||
commander. | ||
version(require('../package').version). | ||
usage('[options] 汉字'). | ||
option('-v, --version', 'output the version number'). | ||
option('-s, --style <style>', 'pinyin styles'). | ||
//option('-h, --heteronym', 'output heteronym pinyins'). | ||
parse(process.argv); | ||
|
||
if (commander.list) { | ||
process.exit() | ||
} | ||
|
||
// output help and exit if no args found | ||
if (commander.args.length === 0) { | ||
commander.help(); | ||
} | ||
|
||
console.log(pinyin(commander.args.join(" "), { | ||
style: pinyin["STYLE_" + (commander.style || "TONE").toUpperCase()], | ||
heteronym: commander.heteronym || false | ||
}).join(" ")); | ||
|
||
/* | ||
vim:ft=javascript | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
{ | ||
"name": "pinyin2", | ||
"version": "0.1.0", | ||
"description": "Chinese Pinyin converter.", | ||
"name": "pinyinjs", | ||
"version": "2.0.1", | ||
"description": "汉语拼音转换工具。", | ||
"main": "src/pinyin.js", | ||
"bin": { | ||
"pinyin": "./bin/pinyin" | ||
}, | ||
"directories": { | ||
"example": "examples", | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "tests/pinyin.js" | ||
"test": "mocha -R spec tests/test.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/hotoo/node-pinyin.git" | ||
}, | ||
"dependencies": { | ||
"segment": "0.0.2", | ||
"simplebig": "0.0.3" | ||
"simplebig": "0.0.3", | ||
"commander": "~1.1.1" | ||
}, | ||
"keywords": ["拼音", "Pinyin"], | ||
"author": "闲耘 <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters