vilicvane / clime

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

Run Commands support #50

Closed mattyclarkson closed 6 years ago

mattyclarkson commented 6 years ago

The rc package provides a standard way to lookup configuration files. It would be great if clime had built in support for the same lookup. I am keen to implement this if you think it would be a good addition to the project. We can avoid statSync that rc does because clime is async by default so we can do the file lookups asynchronously.

If 👍 on this idea, I can do some investigation and figure out a spec before actually implementing it. I imagine it would be in preprocessArguments but that's based on 1 minute or research.

vilicvane commented 6 years ago

Thanks for this suggestion! Instead of having this built-in, I think it might be better to add another Castable implementation outside of the core. E.g.:

export class SomeOptions extends Options {
  @option({
    flag: 'c',
    description: 'some configuration',
    // Currently a string value might be needed to trigger the casting,
    // might add another option on castable to force casting `undefined`.
    // Search `defaultValue` in `cli.ts` for details.
    default: '',
  })
  config: Config;
}
mattyclarkson commented 6 years ago

Thanks for the suggestion. Will look into it.