index.d.ts 677 B

1234567891011121314151617181920
  1. /// <reference types="node" />
  2. declare class CLIError extends Error {
  3. }
  4. declare type Logger = typeof console;
  5. interface IOptions {
  6. [key: string]: number | string | boolean;
  7. }
  8. interface IAnnoations {
  9. description?: string;
  10. params?: string[];
  11. options?: IOptions;
  12. [key: string]: any;
  13. }
  14. declare type PrintHelp = (scriptName: string, annotations: IAnnoations, logger: Logger) => void | null;
  15. declare type CliCallback = (options: IOptions, ...params: string[]) => any;
  16. declare const Cli: {
  17. (argv: string[], annotations?: string | IAnnoations, help?: PrintHelp, logger?: Console): (callback: CliCallback) => any;
  18. CliError: typeof CLIError;
  19. };
  20. export = Cli;