export default class Option { flags: string; defaultValue?: any; /** this option need parameter value. it is required. */ required: boolean; /** this option need parameter value. it is optional. */ optional: boolean; /** this option is default true. if specified this option, value is become false. */ no: boolean; /** short style. e.g. -o */ short?: string; /** long style. e.g. --option */ long: string; /** description of this option */ description: string; /** * class of option. * ``` * cmd --path foo/bar buzz.txt * ↑ this one! * ``` * @param flags pass '-f, --foo'(boolean) or '--foo'(boolean) or '--foo '(string[]) or '--foo [bar]'(string[]). * @param description * @param defaultValue * @class */ constructor(flags: string, description?: string, defaultValue?: any); /** * name of this option. * @returns {any} */ name(): string; /** * check arg is matches this option. * @param arg * @returns {boolean} */ is(arg: string): boolean; /** * parse args. * build to opts. * * e.g. #1 * instance member: required=true, optional=false, short=-f, long=--foo * method arguments: opts={}, args=["--foo", "foo!", "bar!"]. * opts are modified to { foo: ["foo!"] } and return ["bar!"]. * * e.g. #2 * instance member: required=true, optional=false, short=-f, long=--foo * method arguments: opts={ foo: ["foo?"] }, args=["--foo", "foo!", "bar!"]. * opts are modified to { foo: ["foo?", "foo!"] } and return ["bar!"]. * * e.g. #3 * instance member: required=false, optional=false, short=-f, long=--foo * method arguments: opts={}, args=["-f", "foo!", "bar!"]. * opts are modified to { foo: true } and return ["foo!", "bar!"]. * * @param opts * @param args * @returns {string[]} */ parse(opts: any, args: string[]): string[]; }