Skip to content

Commit

Permalink
feat(cli): print shell completion script
Browse files Browse the repository at this point in the history
  • Loading branch information
jrappen committed Mar 18, 2017
1 parent 1def380 commit 804639e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
14 changes: 8 additions & 6 deletions bin/docsify
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ var argv = require('yargs')
}),
handler: (argv) => run.serve(argv.path, argv.open, argv.port)
})
.completion('completion', function (current, argv, done) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve(['init', 'serve'])
}, 10)
})
.command({
command: 'completion',
alias: 'c',
desc: chalk.gray(y18n.__('completion')),
builder: {},
handler: (argv) => {
yargs.showCompletionScript().argv
}
})
.help()
.option('help', {
Expand Down
9 changes: 5 additions & 4 deletions bin/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"usage": "Anwendung",
"completion": "Drucke shell Vervollständigungsskript",
"epilog": "Dokumentation",
"group.globaloptions": "Globale Optionen",
"help": "Zeige Hilfe an",
"init": "Erzeuge neue Dokumentation.",
"init.local": "Kopiere docsify Dateien in lokale Ordner.",
"init.theme": "Zu verwendende Theme Dateien.",
"serve": "Lasse lokalen Server zur Webseitenvorschau laufen.",
"serve.open": "Dokumentation im Standardbrowser öffnen.",
"serve.port": "Listen port.",
"help": "Zeige Hilfe an",
"version": "Zeige Versionsnummer an",
"epilog": "Dokumentation"
"usage": "Anwendung",
"version": "Zeige Versionsnummer an"
}
9 changes: 5 additions & 4 deletions bin/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"usage": "Usage",
"completion": "Print shell completion script",
"epilog": "Documentation",
"group.globaloptions": "Global Options",
"help": "Show help",
"init": "Creates new docs",
"init.local": "Copy docsify files to local.",
"init.theme": "Theme file to be used.",
"serve": "Run local server to preview site.",
"serve.open": "Open docs in default browser.",
"serve.port": "Listen port.",
"help": "Show help",
"version": "Show version number",
"epilog": "Documentation"
"usage": "Usage",
"version": "Show version number"
}
8 changes: 4 additions & 4 deletions bin/locales/zh.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"usage": "例子",
"epilog": "文档",
"help": "帮助",
"init": "创建 docs",
"init.local": "拷贝 docsify 到本地",
"init.theme": "选择主题",
"serve": "本地预览",
"serve.open": "自动打开浏览器",
"serve.port": "设置端口",
"help": "帮助",
"version": "当前版本号",
"epilog": "文档"
"usage": "例子",
"version": "当前版本号"
}

0 comments on commit 804639e

Please sign in to comment.