import { BudgieUtilities } from "../../BudgieUtilities" ; import { CaseStyle } from "../Languages/Casing/CaseStyle" ; import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandResult } from "./CommandResult" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; /**
 * Starts a main context.
 */ export class MainContextStartCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . MainContextStart ) . withDescription ( "Starts a main context" ) ; returns public getMetadata ( ) { return MainContextStartCommand . metadata ; } param parameters returns public render ( parameters ) { const output = [ ] ; const startLines = this . language . syntax . main . contextStartLines ; const fileName = this . context . getFileMetadata ( ) . getFileName ( ) ; for ( const startLine of startLines ) { const line = BudgieUtilities . stringReplaceAll ( startLine , "{0}" , fileName ) ; output . push ( new CommandResult ( line , 0 ) ) ; } if ( output . length !== 0 ) { output [ output . length - 1 ] . indentation = this . language . syntax . main . contextIndentation ; } return new LineResults ( output ) ; } }