Skip to content

Commit

Permalink
Merge pull request #1 from jserme/master
Browse files Browse the repository at this point in the history
加一个拼音可选参数、修复post -d参数时也输出help信息的bug
  • Loading branch information
antife-yinyue committed Mar 11, 2014
2 parents 69228c6 + 18604b8 commit 47ab1c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/jekyll
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jkl
.description('Create a new post')
.option('-d, --drafts', 'As a draft')
.option('--ext <NAME>', 'Specify the extension name (Defaults to md)', 'md')
.option('-p, --pinyin', 'Change Chinese into pinyin')
.action(require(path('post')))

jkl
Expand Down Expand Up @@ -48,6 +49,6 @@ jkl

jkl.parse(process.argv)

if (!jkl.args.length) {
if (jkl.rawArgs.length == 2) {
jkl.help()
}
3 changes: 2 additions & 1 deletion lib/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ require('colors')

module.exports = function(title, options) {
var postDir = options.drafts ? '_drafts' : '_posts'
var fileName = strftime('%F-') + require('han').letter(title, '-') + '.' + options.ext
var pinyinTitle = options.pinyin ? require('han').letter(title, '-') : title
var fileName = strftime('%F-') + pinyinTitle + '.' + options.ext
var filePath = join(postDir, fileName)

if (fs.existsSync(filePath)) {
Expand Down

0 comments on commit 47ab1c9

Please sign in to comment.