Merge pull request #263 from geoadmin/nomnom_commander
Replace Nomnom with Commander
This commit is contained in:
commit
e737753891
3 changed files with 52 additions and 51 deletions
|
@ -4,21 +4,21 @@ Usage
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
======
|
======
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
Usage: tileserver-gl [mbtiles] [options]
|
Usage: main.js tileserver-gl [mbtiles] [options]
|
||||||
|
|
||||||
mbtiles MBTiles file (uses demo configuration);
|
Options:
|
||||||
ignored if the configuration file is also specified
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-c, --config Configuration file [config.json]
|
|
||||||
-b, --bind Bind address
|
|
||||||
-p, --port Port [8080]
|
|
||||||
-V, --verbose More verbose output
|
|
||||||
-v, --version Version info
|
|
||||||
|
|
||||||
|
-h, --help output usage information
|
||||||
|
--mbtiles <file> MBTiles file (uses demo configuration);
|
||||||
|
ignored if the configuration file is also specified
|
||||||
|
-c, --config <file> Configuration file [config.json]
|
||||||
|
-b, --bind <address> Bind address
|
||||||
|
-p, --port <port> Port [8080]
|
||||||
|
-C|--no-cors Disable Cross-origin resource sharing headers
|
||||||
|
-V, --verbose More verbose output
|
||||||
|
-v, --version Version info
|
||||||
|
|
||||||
|
|
||||||
Default styles and configuration
|
Default styles and configuration
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
"canvas": "1.6.8",
|
"canvas": "1.6.8",
|
||||||
"clone": "2.1.1",
|
"clone": "2.1.1",
|
||||||
"color": "1.0.3",
|
"color": "1.0.3",
|
||||||
|
"commander": "2.1.0",
|
||||||
"cors": "2.8.4",
|
"cors": "2.8.4",
|
||||||
"express": "4.16.2",
|
"express": "4.16.2",
|
||||||
"glyph-pbf-composite": "0.0.2",
|
"glyph-pbf-composite": "0.0.2",
|
||||||
"handlebars": "4.0.11",
|
"handlebars": "4.0.11",
|
||||||
"http-shutdown": "^1.2.0",
|
"http-shutdown": "^1.2.0",
|
||||||
"morgan": "1.9.0",
|
"morgan": "1.9.0",
|
||||||
"nomnom": "1.8.1",
|
|
||||||
"pbf": "3.0.5",
|
"pbf": "3.0.5",
|
||||||
"proj4": "2.4.4",
|
"proj4": "2.4.4",
|
||||||
"request": "2.83.0",
|
"request": "2.83.0",
|
||||||
|
|
79
src/main.js
79
src/main.js
|
@ -10,46 +10,47 @@ var mbtiles = require('@mapbox/mbtiles');
|
||||||
|
|
||||||
var packageJson = require('../package');
|
var packageJson = require('../package');
|
||||||
|
|
||||||
var opts = require('nomnom')
|
var args = process.argv;
|
||||||
.option('mbtiles', {
|
if (args.length >= 3 && args[2][0] != '-') {
|
||||||
default: undefined,
|
args.splice(2, 0, '--mbtiles');
|
||||||
help: 'MBTiles file (uses demo configuration);\n' +
|
}
|
||||||
'\t ignored if the configuration file is also specified',
|
|
||||||
position: 0
|
|
||||||
})
|
|
||||||
.option('config', {
|
|
||||||
abbr: 'c',
|
|
||||||
default: 'config.json',
|
|
||||||
help: 'Configuration file'
|
|
||||||
})
|
|
||||||
.option('bind', {
|
|
||||||
abbr: 'b',
|
|
||||||
default: undefined,
|
|
||||||
help: 'Bind address'
|
|
||||||
})
|
|
||||||
.option('port', {
|
|
||||||
abbr: 'p',
|
|
||||||
default: 8080,
|
|
||||||
help: 'Port'
|
|
||||||
})
|
|
||||||
.option('cors', {
|
|
||||||
default: true,
|
|
||||||
help: 'Enable Cross-origin resource sharing headers'
|
|
||||||
})
|
|
||||||
.option('verbose', {
|
|
||||||
abbr: 'V',
|
|
||||||
flag: true,
|
|
||||||
help: 'More verbose output'
|
|
||||||
})
|
|
||||||
.option('version', {
|
|
||||||
abbr: 'v',
|
|
||||||
flag: true,
|
|
||||||
help: 'Version info',
|
|
||||||
callback: function() {
|
|
||||||
return packageJson.name + ' v' + packageJson.version;
|
|
||||||
}
|
|
||||||
}).parse();
|
|
||||||
|
|
||||||
|
var opts = require('commander')
|
||||||
|
.description('tileserver-gl startup options')
|
||||||
|
.usage('tileserver-gl [mbtiles] [options]')
|
||||||
|
.option(
|
||||||
|
'--mbtiles <file>',
|
||||||
|
'MBTiles file (uses demo configuration);\n' +
|
||||||
|
'\t ignored if the configuration file is also specified'
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-c, --config <file>',
|
||||||
|
'Configuration file [config.json]',
|
||||||
|
'config.json'
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-b, --bind <address>',
|
||||||
|
'Bind address'
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-p, --port <port>',
|
||||||
|
'Port [8080]',
|
||||||
|
parseInt,
|
||||||
|
8080
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-C|--no-cors',
|
||||||
|
'Disable Cross-origin resource sharing headers'
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-V, --verbose',
|
||||||
|
'More verbose output'
|
||||||
|
)
|
||||||
|
.version(
|
||||||
|
packageJson.version,
|
||||||
|
'-v, --version'
|
||||||
|
)
|
||||||
|
.parse(args);
|
||||||
|
|
||||||
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
|
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue