mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-27 04:06:39 +02:00
Fix for issue #204, added width option to the CLI. Default value for width is 1200.
Added logger using es6 syntax
This commit is contained in:
10
lib/cli.js
10
lib/cli.js
@@ -27,6 +27,7 @@ function cli(options) {
|
||||
, sequenceConfig: 'c'
|
||||
, ganttConfig: 'g'
|
||||
, css: 't'
|
||||
, width: 'w'
|
||||
}
|
||||
, 'boolean': ['help', 'png', 'svg']
|
||||
, 'string': ['outputDir']
|
||||
@@ -50,6 +51,7 @@ function cli(options) {
|
||||
, " -g --ganttConfig Specify the path to the file with the configuration to be applied in the gantt diagram"
|
||||
, " -h --help Show this message"
|
||||
, " -v --verbose Show logging"
|
||||
, " -w --width width of the generated png (number)"
|
||||
, " --version Print version and quit"
|
||||
]
|
||||
|
||||
@@ -97,11 +99,8 @@ cli.prototype.parse = function(argv, next) {
|
||||
options.sequenceConfig = checkConfig(options.sequenceConfig)
|
||||
}
|
||||
|
||||
|
||||
if (options.ganttConfig) {
|
||||
console.log('Got conf1'+options.ganttConfig);
|
||||
options.ganttConfig = checkConfig(options.ganttConfig)
|
||||
console.log('Got conf'+options.ganttConfig);
|
||||
}
|
||||
|
||||
if (options.css) {
|
||||
@@ -114,6 +113,11 @@ cli.prototype.parse = function(argv, next) {
|
||||
options.css = fs.readFileSync(path.join(__dirname, '..', 'dist', 'mermaid.css'))
|
||||
}
|
||||
|
||||
// set svg/png flags appropriately
|
||||
if(!options.width){
|
||||
options.width = 1200;
|
||||
}
|
||||
|
||||
this.checkPhantom = createCheckPhantom(options.phantomPath)
|
||||
|
||||
this.checkPhantom(function(err, path) {
|
||||
|
Reference in New Issue
Block a user