import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * An indexed string lookup.
 */ export class StringIndexCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . StringIndex ) . withDescription ( "An indexed string lookup" ) . withParameters ( [ new SingleParameter ( "string" , "A string to look within." , true ) , new SingleParameter ( "index" , "The index within the string." , true ) , ] ) ; returns public getMetadata ( ) { return StringIndexCommand . metadata ; } param parameters returns public render ( parameters ) { let output = parameters [ 1 ] ; output += this . language . syntax . strings . indexLeft ; output += parameters [ 2 ] ; output += this . language . syntax . strings . indexRight ; return LineResults . newSingleLine ( output ) . withAddSemicolon ( true ) ; } }