From 881ceb78eee4eca30aae3bdd61be881834aec3d3 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Tue, 23 Apr 2019 15:11:18 +0200 Subject: [PATCH 1/3] fix --help on subcommands --- bin/kuzzle | 133 +++++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/bin/kuzzle b/bin/kuzzle index e38f83da85..855adfab71 100755 --- a/bin/kuzzle +++ b/bin/kuzzle @@ -29,86 +29,91 @@ */ const program = require('commander'); -program - .version(require('../package.json').version) - .option('-p, --port ', 'Kuzzle port number', parseInt) - .option('-h, --host ', 'Kuzzle host') - .option('-U, --username ', 'Admin username') - .option('-P, --password ', 'Admin password') - .option('-d, --debug', 'make errors more verbose') - .option('-C, --noColors', 'do not use ANSI coloring'); +program.version(require('../package.json').version).usage('[command] --help'); + +const bindOption = cmd => + cmd + .option('-p, --port ', 'Kuzzle port number', parseInt) + .option('-h, --host ', 'Kuzzle host') + .option('-U, --username ', 'Admin username') + .option('-P, --password ', 'Admin password') + .option('-d, --debug', 'make errors more verbose') + .option('-C, --noColors', 'do not use ANSI coloring'); // $ kuzzle createFirstAdmin -program - .command('createFirstAdmin') - .description('create the first administrator user') - .action(require('./commands/createFirstAdmin')); +bindOption( + program + .command('createFirstAdmin') + .description('create the first administrator user') + .action(require('./commands/createFirstAdmin')) +); // $ kuzzle clearCache -program - .command('clearCache') - .description('clear internal caches in Redis') - .action(require('./commands/resetCache')); +bindOption( + program + .command('clearCache') + .description('clear internal caches in Redis') + .action(require('./commands/resetCache')) +); // $ kuzzle reset -program - .command('reset') - .description('reset all users, profiles, roles and documents validation specifications') - .option('--noint', 'non interactive mode') - .action(require('./commands/resetKuzzleData')); +bindOption( + program + .command('reset') + .description( + 'reset all users, profiles, roles and documents validation specifications' + ) + .option('--noint', 'non interactive mode') + .action(require('./commands/resetKuzzleData')) +); // $ kuzzle resetSecurity -program - .command('resetSecurity') - .description('reset all users, profiles and roles') - .option('--noint', 'non interactive mode') - .action(require('./commands/resetSecurity')); +bindOption( + program + .command('resetSecurity') + .description('reset all users, profiles and roles') + .option('--noint', 'non interactive mode') + .action(require('./commands/resetSecurity')) +); // $ kuzzle resetDatabase -program - .command('resetDatabase') - .description('remove all data stored on Kuzzle') - .option('--noint', 'non interactive mode') - .action(require('./commands/resetDatabase')); +bindOption( + program + .command('resetDatabase') + .description('remove all data stored on Kuzzle') + .option('--noint', 'non interactive mode') + .action(require('./commands/resetDatabase')) +); // $ kuzzle shutdown -program - .command('shutdown') - .description('gracefully exits after processing remaining requests') - .action(require('./commands/shutdown')); +bindOption( + program + .command('shutdown') + .description('gracefully exits after processing remaining requests') + .action(require('./commands/shutdown')) +); // $ kuzzle start -program - .command('start') - .description('start a Kuzzle instance') - .option(' --fixtures ', 'import data from file') - .option(' --mappings ', 'apply mappings from file') - .option(' --securities ', 'import roles, profiles and users from file') - .action(require('./commands/start')); +bindOption( + program + .command('start') + .description('start a Kuzzle instance') + .option(' --fixtures ', 'import data from file') + .option(' --mappings ', 'apply mappings from file') + .option( + ' --securities ', + 'import roles, profiles and users from file' + ) + .action(require('./commands/start')) +); // $ kuzzle dump -program - .command('dump') - .description('create a dump of current state of kuzzle') - .action(require('./commands/dump')); - -// $ kuzzle loadMappings -program - .command('loadMappings ') - .description('load database mappings into Kuzzle') - .action(require('./commands/loadMappings')); - -// $ kuzzle loadFixtures -program - .command('loadFixtures ') - .description('load database fixtures into Kuzzle') - .action(require('./commands/loadFixtures')); - -// $ kuzzle loadSecurities -program - .command('loadSecurities ') - .description('load roles, profiles and users into Kuzzle') - .action(require('./commands/loadSecurities')); +bindOption( + program + .command('dump') + .description('create a dump of current state of kuzzle') + .action(require('./commands/dump')) +); // Run user command program.parse(process.argv); From 857b4e93a927f8a2b0423f8814616cbc291c3936 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 24 Apr 2019 10:10:39 +0200 Subject: [PATCH 2/3] fix test node6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8cc15c47a..efc9ec43e7 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "uws": "10.148.0", "validator": "^10.11.0", "winston": "^3.2.1", - "winston-elasticsearch": "^0.7.9", + "winston-elasticsearch": "0.7.8", "winston-syslog": "^2.1.0", "winston-transport": "^4.3.0" }, From ffc9fa3808e6cb6872ed0df4e4342e049ca5ef90 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 24 Apr 2019 11:14:09 +0200 Subject: [PATCH 3/3] load commands --- bin/kuzzle | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/kuzzle b/bin/kuzzle index 855adfab71..d32fff2a60 100755 --- a/bin/kuzzle +++ b/bin/kuzzle @@ -115,6 +115,30 @@ bindOption( .action(require('./commands/dump')) ); +// $ kuzzle loadMappings +bindOption( + program + .command('loadMappings ') + .description('load database mappings into Kuzzle') + .action(require('./commands/loadMappings')) +); + +// $ kuzzle loadFixtures +bindOption( + program + .command('loadFixtures ') + .description('load database fixtures into Kuzzle') + .action(require('./commands/loadFixtures')) +); + +// $ kuzzle loadSecurities +bindOption( + program + .command('loadSecurities ') + .description('load roles, profiles and users into Kuzzle') + .action(require('./commands/loadSecurities')) +); + // Run user command program.parse(process.argv);