You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
473 B
21 lines
473 B
import Command from "@oclif/command"; |
|
|
|
import { Database, ServerState } from "."; |
|
|
|
export default abstract class ManageCommand extends Command { |
|
state!: ServerState; |
|
database!: Database; |
|
|
|
async connect() { |
|
this.state = new ServerState(); |
|
await this.state.startDatabase(); |
|
this.database = this.state.database; |
|
} |
|
|
|
async finally(e: Error | undefined) { |
|
if (this.state) { |
|
await this.state.stopDatabase(); |
|
} |
|
await super.finally(e); |
|
} |
|
}
|
|
|