balena-cli/typings/capitano.d.ts
Tim Perry 83a76f7d6f Start using Prettier
Change-Type: patch
2018-01-10 09:23:00 +01:00

57 lines
1.1 KiB
TypeScript

declare module 'capitano' {
export function parse(argv: string[]): Cli;
export interface Cli {
command: string;
options: {};
global: {};
}
export interface OptionDefinition {
signature: string;
description: string;
parameter?: string;
boolean?: boolean;
alias?: string | string[];
}
export interface CommandDefinition<P = {}, O = {}> {
signature: string;
description: string;
help: string;
options?: OptionDefinition[];
permission?: 'user';
action(params: P, options: O, done: () => void): void;
}
export interface Command {
signature: Signature;
options: Option[];
isWildcard(): boolean;
}
export interface Signature {
hasParameters(): boolean;
hasVariadicParameters(): boolean;
isWildcard(): boolean;
allowsStdin(): boolean;
}
export interface Option {
signature: Signature;
alias: string | string[];
boolean: boolean;
parameter: string;
required: boolean | string;
}
export function command(command: CommandDefinition): void;
export const state: {
getMatchCommand: (
signature: string,
callback: (e: Error, cmd: Command) => void,
) => void;
};
}