| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | /// <reference types="q"/> |
| 2 | |
| 3 | export const Arg: undefined; |
| 4 | |
| 5 | export const Opt: undefined; |
| 6 | |
| 7 | export function Cmd(cmd?: classes.Cmd): classes.Cmd; |
| 8 | |
| 9 | export namespace classes { |
| 10 | class Arg { |
| 11 | constructor(cmd: Cmd); |
| 12 | name(name: string): Arg; |
| 13 | title(title: string): Arg; |
| 14 | arr(): Arg; |
| 15 | req(): Arg; |
| 16 | val(validation: (this: Arg, value: any) => boolean): Arg; |
| 17 | def(def: any): Arg; |
| 18 | output(): Arg; |
| 19 | comp(fn: (opts: any) => any): Arg; |
| 20 | end(): Cmd; |
| 21 | apply(...args: any[]): Arg; |
| 22 | input(): Arg; |
| 23 | reject(...args: any[]): Arg; |
| 24 | } |
| 25 | |
| 26 | class Cmd { |
| 27 | constructor(cmd?: Cmd); |
| 28 | static create(cmd?: Cmd): Cmd; |
| 29 | api(): any; |
| 30 | name(name: string): Cmd; |
| 31 | title(title: string): Cmd; |
| 32 | cmd(cmd?: Cmd): Cmd; |
| 33 | opt(): Opt; |
| 34 | arg(): Arg; |
| 35 | act(act: (opts: any, args: any[], res: any) => any, force?: boolean): Cmd; |
| 36 | apply(fn: Function, args?: any[]): Cmd; |
| 37 | comp(fs: (opts: any) => any): Cmd; |
| 38 | helpful(): Cmd; |
| 39 | completable(): Cmd; |
| 40 | usage(): string; |
| 41 | run(argv: string[]): Cmd; |
| 42 | invoke(cmds?: string|string[], opts?: any, args?: any): Q.Promise<any>; |
| 43 | reject(reason: any): Q.Promise<any>; |
| 44 | end(): Cmd; |
| 45 | do(argv: string[]): any; |
| 46 | extendable(pattern?: string): Cmd; |
| 47 | } |
| 48 | |
| 49 | class Opt { |
| 50 | constructor(cmd?: Cmd); |
| 51 | name(name: string): Opt; |
| 52 | title(title: string): Opt; |
| 53 | short(short: string): Opt; |
| 54 | long(long: string): Opt; |
| 55 | flag(): Opt; |
| 56 | arr(): Opt; |
| 57 | req(): Opt; |
| 58 | only(): Opt; |
| 59 | val(validation: (this: Opt, value: any) => boolean): Opt; |
| 60 | def(def: any): Opt; |
| 61 | input(): Opt; |
| 62 | output(): Opt; |
| 63 | act(act: (opts: any, args: any[], res: any) => any): Opt; |
| 64 | comp(fn: (opts: any) => any): Opt; |
| 65 | end(): Cmd; |
| 66 | apply(...args: any[]): void; |
| 67 | reject(...args: any[]): void; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | export namespace shell { |
| 72 | function escape(w: string): string; |
| 73 | function unescape(w: string): string; |
| 74 | } |