vilicvane / clime

⌨ The command-line interface framework for TypeScript.
252 stars 10 forks source link

Parameter arrays #49

Closed jbboehr closed 6 years ago

jbboehr commented 6 years ago

Just checking, but are parameter arrays supposed to work?

import {Command, command, param, option, Options} from 'clime';

export class DefaultOptions extends Options {
    @option({

    })
    cacheTtl: number;

    @option({
        type: String,
        required: true,
    })
    output: string;
}

@command({
    description: 'This is a command for printing a greeting message',
})
export default class extends Command {
    async execute(
        @param({
            type: String,
            description: 'extra parameters',
        })
        args: string[],

        options: DefaultOptions,
    ) {
    }
}

Gives me the output (at runtime) of:

$ tsc && node ./dist/src/cli.js a b
ERR Expecting 1 parameter(s) at most but got 2 instead.
vilicvane commented 6 years ago

Hi, you may want to try params decorator instead of param.

jbboehr commented 6 years ago

Oops, guess I missed the s in the example.