import { CommandNode } from "../../../../Tokenization/Nodes/CommandNode" ; import { IParameter } from "./Parameter" ; /**
 * A single named parameter.
 */ export class SingleParameter implements IParameter { /**
     * A plain-text description of this parameter.
     */ public description : string ; /**
     * The name of this parameter.
     */ public name : string ; /**
     * Whether this must be provided.
     */ public required : boolean ; param descriptor param parameters param required public constructor ( name , description , required ) { this . name = name ; this . description = description ; this . required = required ; } returns public isRequired ( ) { return this . required ; } param node param inputPosition param requirements param requirementPosition returns public validate ( node , inputPosition , requirements , requirementPosition ) { if ( this . required && inputPosition >= node . args . length ) { throw new Error ( `${ node . command }: Missing parameter: '${ this . name }'` ) ; } return inputPosition + 1 ; } }