mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 05:19:58 +02:00
Fix code style issues
This commit is contained in:
42
lib/cli.js
42
lib/cli.js
@@ -1,21 +1,21 @@
|
||||
var fs = require('fs'),
|
||||
exec = require('child_process').exec,
|
||||
chalk = require('chalk'),
|
||||
which = require('which'),
|
||||
parseArgs = require('minimist'),
|
||||
semver = require('semver'),
|
||||
path = require('path')
|
||||
var fs = require('fs')
|
||||
var exec = require('child_process').exec
|
||||
var chalk = require('chalk')
|
||||
var which = require('which')
|
||||
var parseArgs = require('minimist')
|
||||
var semver = require('semver')
|
||||
var path = require('path')
|
||||
|
||||
var PHANTOM_VERSION = '^2.1.0'
|
||||
|
||||
var info = chalk.blue.bold,
|
||||
note = chalk.green.bold
|
||||
var info = chalk.blue.bold
|
||||
// var note = chalk.green.bold
|
||||
|
||||
module.exports = (function () {
|
||||
return new cli()
|
||||
return new Cli()
|
||||
}())
|
||||
|
||||
function cli (options) {
|
||||
function Cli (options) {
|
||||
this.options = {
|
||||
alias: {
|
||||
help: 'h',
|
||||
@@ -37,7 +37,7 @@ function cli (options) {
|
||||
this.errors = []
|
||||
this.message = null
|
||||
|
||||
this.helpMessage = [,
|
||||
this.helpMessage = [
|
||||
info('Usage: mermaid [options] <file>...'),
|
||||
'',
|
||||
'file The mermaid description file to be rendered',
|
||||
@@ -60,10 +60,10 @@ function cli (options) {
|
||||
return this
|
||||
}
|
||||
|
||||
cli.prototype.parse = function (argv, next) {
|
||||
Cli.prototype.parse = function (argv, next) {
|
||||
this.errors = [] // clear errors
|
||||
var options = parseArgs(argv, this.options),
|
||||
phantom
|
||||
var options = parseArgs(argv, this.options)
|
||||
// var phantom
|
||||
|
||||
if (options.version) {
|
||||
var pkg = require('../package.json')
|
||||
@@ -138,7 +138,7 @@ cli.prototype.parse = function (argv, next) {
|
||||
}
|
||||
options.phantomPath = path
|
||||
next(
|
||||
this.errors.length > 0 ? this.errors : null
|
||||
this.errors.length > 0 ? this.errors : null
|
||||
, this.message
|
||||
, options
|
||||
)
|
||||
@@ -147,12 +147,12 @@ cli.prototype.parse = function (argv, next) {
|
||||
}
|
||||
|
||||
function createCheckPhantom (_phantomPath) {
|
||||
var phantomPath = _phantomPath,
|
||||
phantomVersion
|
||||
var phantomPath = _phantomPath
|
||||
// var phantomVersion
|
||||
|
||||
return function checkPhantom (_next) {
|
||||
var next = _next || function () {},
|
||||
err
|
||||
var next = _next || function () { }
|
||||
var err
|
||||
|
||||
if (typeof phantomPath === 'undefined') {
|
||||
try {
|
||||
@@ -186,7 +186,7 @@ function createCheckPhantom (_phantomPath) {
|
||||
next(new Error('Could not find phantomjs at the specified path.'))
|
||||
} else if (!semver.satisfies(stdout, PHANTOM_VERSION)) {
|
||||
next(new Error(
|
||||
'mermaid requires phantomjs ' +
|
||||
'mermaid requires phantomjs ' +
|
||||
PHANTOM_VERSION +
|
||||
' to be installed, found version ' +
|
||||
stdout
|
||||
|
Reference in New Issue
Block a user