Support for values of parameters
chandru89new opened this issue · comments
Hi. Thanks for the neat little package. Been playing with it for some scripts I use personally I see it's quite handy.
I noticed that there's no information on whether func
can handle values of parameters.
Example:
tools test --input something --output abcd
Expected output:
// console.log(arg.option)
{
'--input': 'something',
'--output': 'abcd'
}
Is this already available in some form that I am missing? If so please can you point me to it.
If not, please do think of adding this :)
Welcome. If you want to add params to the command, I recommend you try SubOptions
decorator.
Example:
tools test --input something
Code:
import { Command, CommandArgsProvider, SubOptions } from 'func'
@Command({
name: 'test',
})
@SubOptions([{ name: 'input', alias: 'i', type: String }])
export class Test {
constructor(
private args: CommandArgsProvider,
) {
console.log('test invoked.')
console.log(args.option) // output: `{ input: 'something' }`
}
}
Can it solve your problem, please reply me if you have any questions.
Hi. Thanks for this. @SubOptions is good enough for my requirement right now. Thanks a lot :)