import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * Gets an item in an array by index.
 */ export class ArrayGetCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . ArrayGet ) . withDescription ( "Gets an item in an array by index" ) . withParameters ( [ new SingleParameter ( "array" , "An array to look within." , true ) , new SingleParameter ( "index" , "The index within the array." , true ) , ] ) ; returns public getMetadata ( ) { return ArrayGetCommand . metadata ; } param parameters returns public render ( parameters ) { return LineResults . newSingleLine ( parameters [ 1 ] + "[" + parameters [ 2 ] + "]" ) . withAddSemicolon ( true ) ; } }