Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Commit

Permalink
add pinyin arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jserme committed Mar 11, 2014
1 parent 69228c6 commit 43b6042
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/jekyll
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
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 title = options.pinyin ? require('han').letter(title, '-') : title
var fileName = strftime('%F-') + title + '.' + options.ext
var filePath = join(postDir, fileName)

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

0 comments on commit 43b6042

Please sign in to comment.