UNPKG

morpheus4j

Version:

Morpheus is a migration tool for Neo4j. It aims to be a simple and intuitive way to migrate your database.

63 lines 2.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCommand = void 0; const core_1 = require("@oclif/core"); const config_service_1 = require("./services/config.service"); const logger_1 = require("./services/logger"); const shared_flags_1 = require("./shared-flags"); class BaseCommand extends core_1.Command { static baseFlags = { debug: core_1.Flags.boolean({ default: false, description: 'Enable debug logging', helpGroup: 'GLOBAL' }), }; static enableJsonFlag = true; // define flags that can be inherited by any command that extends BaseCommand static flags = { ...shared_flags_1.ConfigFlags, ...shared_flags_1.ConnectionFlags, ...shared_flags_1.AuthFlags, ...shared_flags_1.DatabaseFlags, }; args; flags; // eslint-disable-next-line @typescript-eslint/no-explicit-any async catch(err) { // add any custom logic to handle errors from the command // or simply return the parent class error handling return super.catch(err); } // eslint-disable-next-line @typescript-eslint/no-explicit-any async finally(_) { // called after run and catch regardless of whether or not the command errored return super.finally(_); } getConfig() { const config = config_service_1.ConfigService.load({ database: this.flags.database, host: this.flags.host, migrationsPath: this.flags.migrationsPath, password: this.flags.password, port: this.flags.port, scheme: this.flags.scheme, username: this.flags.username, }, this.getConfigFile()); return config; } getConfigFile() { return this.flags.configFile; } async init() { await super.init(); const { args, flags } = await this.parse({ args: this.ctor.args, baseFlags: super.ctor.baseFlags, enableJsonFlag: this.ctor.enableJsonFlag, flags: this.ctor.flags, strict: this.ctor.strict, }); this.flags = flags; this.args = args; logger_1.Logger.initialize(flags.json, flags.debug); } } exports.BaseCommand = BaseCommand; //# sourceMappingURL=base-command.js.map