Something went wrong. Try again.
A self-hosted web platform for applications & services with design based on Google's Material 3 Expressive. (Work In Progress)
self-hosted typescript
Something went wrong. Try again.
1.8 kB · 57 lines
TypeScript
at commit 3b00a86a
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import Command, { type ICommandRuntimeParameters } from "../command.ts";import chalk from "chalk";import { WorkspacesFeatureFlags } from "../../configuration.ts";
export default class EnableFeatureCommand extends Command { override commandId = "feature"; flags = {}; aliases = []; override shortDescription = "Manage instance enabled features";
async run(parameters: ICommandRuntimeParameters) { const action = await this.promptUser("Action", (a) => { switch (a.toLowerCase()) { case "enable": case "disable": case "help": case "list": return true; default: return false; } });
switch (action.toLowerCase()) { case "enable": { const featureId = await this.promptUser("FeatureId");
this.instance.log.system.info(`Enabling feature '${featureId}'`);
await this.instance.sys.configuration.enableFeature(featureId); break; } case "disable": { const featureId = await this.promptUser("FeatureId");
this.instance.log.system.info(`Disabling feature '${featureId}'`);
await this.instance.sys.configuration.disableFeature(featureId); break; } case "help": { this.instance.log.system.info(`Available commands: 'enable', 'disable', 'help', 'list'`); break; } case "list": { for (const feat of Object.values(WorkspacesFeatureFlags)) { this.log.info(`Feature: ${feat} -> ${this.instance.sys.configuration.hasFeature(feat)}`); }
this.log.info(`Enabled features -> ${this.instance.sys.configuration.enabledFeatures.join(", ")}`); break; } }
return this.finishRun(); }}