Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ivogabe committed May 28, 2014
1 parent 3f31c13 commit a893558
Show file tree
Hide file tree
Showing 149 changed files with 15,564 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
examples
definitions
lib
gulpfile.js
tslint.json
2 changes: 2 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./release/bin');
670 changes: 670 additions & 0 deletions definitions/bluebird.d.ts

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions definitions/browser-builtins.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
declare module 'browser-builtins' {
var a: {
[ name: string ]: string;

assert: string;
child_process: string;
cluster: string;
dgram: string;
dns: string;
domain: string;
events: string;
fs: string;
https: string;
net: string;
path: string;
process: string;
querystring: string;
readline: string;
repl: string;
stream: string;
string_decoder: string;
sys: string;
timers: string;
tls: string;
tty: string;
url: string;
util: string;
punycode: string;
http: string;
vm: string;
crypto: string;
console: string;
zlib: string;
buffer: string;
constants: string;
os: string;
};
export = a;
}
52 changes: 52 additions & 0 deletions definitions/chalk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
declare module 'chalk' {
export interface ColorStyle {
(str: string): string;

reset: ColorStyle;
bold: ColorStyle;
italic: ColorStyle;
underline: ColorStyle;
inverse: ColorStyle;
strikethrough: ColorStyle;
black: ColorStyle;
red: ColorStyle;
green: ColorStyle;
yellow: ColorStyle;
blue: ColorStyle;
magenta: ColorStyle;
cyan: ColorStyle;
white: ColorStyle;
gray: ColorStyle;
bgBlack: ColorStyle;
bgRed: ColorStyle;
bgGreen: ColorStyle;
bgYellow: ColorStyle;
bgBlue: ColorStyle;
bgMagenta: ColorStyle;
bgCyan: ColorStyle;
bgWhite: ColorStyle;
}
export var reset: ColorStyle;
export var bold: ColorStyle;
export var italic: ColorStyle;
export var underline: ColorStyle;
export var inverse: ColorStyle;
export var strikethrough: ColorStyle;
export var black: ColorStyle;
export var red: ColorStyle;
export var green: ColorStyle;
export var yellow: ColorStyle;
export var blue: ColorStyle;
export var magenta: ColorStyle;
export var cyan: ColorStyle;
export var white: ColorStyle;
export var gray: ColorStyle;
export var bgBlack: ColorStyle;
export var bgRed: ColorStyle;
export var bgGreen: ColorStyle;
export var bgYellow: ColorStyle;
export var bgBlue: ColorStyle;
export var bgMagenta: ColorStyle;
export var bgCyan: ColorStyle;
export var bgWhite: ColorStyle;
}
228 changes: 228 additions & 0 deletions definitions/commander.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
// Type definitions for commanderjs 1.1.1
// Project: https://github.com/visionmedia/commander.js
// Definitions by: Marcelo Dezem <http://github.com/mdezem>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module "commander" {
export interface Command {
/**
* The command name.
*/
name: string;

//
//
// NOTE: the methods below are COPIED to the module
// as functions exports. If changes need to be made here,
// remember to re-paste the definitions in the module.
// Read below to know why such ugly thing is required.
//
//

/**
* Register callback fn for the command.
*/
action(fn: (...args: any[]) => any): Command;

/**
* Define option with flags, description and optional coercion function and default value.
* The flags string should contain both the short and long flags
* separated by comma, a pipe or space. The following are all valid
* all will output this way when --help is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* @param flags the option flags.
* @param description the option description. The description is printed when "--help" is used.
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
* @param defaultValue (optional) specifies a default value.
*/
option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;


/**
* Sets the command version
*/
version(version: string): Command;

/**
* Parse the arguments array and invokes the commands passing the parsed options.
* @param argv the arguments array.
*/
parse(argv: string[]): Command;

/**
* Gets or sets the command description.
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
*/
description(description: string): Command;
description(): string;

/**
* Gets or sets the usage help string.
*/
usage(usage: string): Command;
usage(): string;

/*
* Prompt the user for a value, calling the callback function.
*
* Supports single-line and multi-line prompts.
* To issue a single-line prompt simply add a whitespace
* to the end of label, something like "name: ", whereas
* for a multi-line prompt omit this "description:".
* @param label the label string to be printed in console.
* @param callback a callback function to handle the inputed string.
*/
prompt(label: string, callback: (value: string) => any): void;

promptForNumber(label: string, callback: (value: number) => any): void;
promptForDate(label: string, callback: (value: Date) => any): void;
promptSingleLine(label: string, callback: (value: string) => any): void;
promptMultiLine(label: string, callback: (value: string) => any): void;

/**
* Prompt for password with a label, a optional mask char and callback function.
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
*/
password(label: string, mask: string, callback: (value: string) => any): void;
password(label: string, callback: (value: string) => any): void;

/**
* Prompts the user for a confirmation.
*/
confirm(label: string, callback: (flag: boolean) => any): void;

/**
* Prompt for password with str, mask char and callback fn(val).
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
*/
choose(options: string[], callback: (idx: number) => any): void;
choose(options: any[], callback: (idx: number) => any): void;

/**
* Add command with the specified name. Returns a new instance of Command.
*
* The .action() callback is invoked when the
* command name is specified via ARGV,
* and the remaining arguments are applied to the
* function for access.
* When the name is "*" an un-matched command
* will be passed as the first arg, followed by
* the rest of ARGV remaining.
*
* @param name the name of the command. Pass "*" to trap un-matched commands.
*/
command(name: string): Command;
}

//
//
// since TypeScript (and ECMA6) does not supports module.exports,
// there is no way to set the default Command instance as the module itself.
// It's ugly but the only way is to copy all the methods from Command
// and paste it in the module as functions exports.
//
//

/**
* Register callback fn for the command.
*/
export function action(fn: (...args: any[]) => any): Command;

/**
* Define option with flags, description and optional coercion function and default value.
* The flags string should contain both the short and long flags
* separated by comma, a pipe or space. The following are all valid
* all will output this way when --help is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* @param flags the option flags.
* @param description the option description. The description is printed when "--help" is used.
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
* @param defaultValue (optional) specifies a default value.
*/
export function option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;


/**
* Sets the command version
*/
export function version(version: string): Command;

/**
* Parse the arguments array and invokes the commands passing the parsed options.
* @param argv the arguments array.
*/
export function parse(argv: string[]): Command;

/**
* Gets or sets the command description.
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
*/
export function description(description: string): Command;
export function description(): string;

/**
* Gets or sets the usage help string.
*/
export function usage(usage: string): Command;
export function usage(): string;

/*
* Prompt the user for a value, calling the callback function.
*
* Supports single-line and multi-line prompts.
* To issue a single-line prompt simply add a whitespace
* to the end of label, something like "name: ", whereas
* for a multi-line prompt omit this "description:".
* @param label the label string to be printed in console.
* @param callback a callback function to handle the inputed string.
*/
export function prompt(label: string, callback: (value: string) => any): void;

export function promptForNumber(label: string, callback: (value: number) => any): void;
export function promptForDate(label: string, callback: (value: Date) => any): void;
export function promptSingleLine(label: string, callback: (value: string) => any): void;
export function promptMultiLine(label: string, callback: (value: string) => any): void;
/**
* Prompt for password with a label, a optional mask char and callback function.
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
*/
export function password(label: string, mask: string, callback: (value: string) => any): void;
export function password(label: string, callback: (value: string) => any): void;

/**
* Prompts the user for a confirmation.
*/
export function confirm(label: string, callback: (flag: boolean) => any): void;

/**
* Prompt for password with str, mask char and callback fn(val).
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
*/
export function choose(options: string[], callback: (idx: number) => any): void;
export function choose(options: any[], callback: (idx: number) => any): void;

/**
* Add command with the specified name. Returns a new instance of Command.
*
* The .action() callback is invoked when the
* command name is specified via ARGV,
* and the remaining arguments are applied to the
* function for access.
* When the name is "*" an un-matched command
* will be passed as the first arg, followed by
* the rest of ARGV remaining.
*
* @param name the name of the command. Pass "*" to trap un-matched commands.
*/
export function command(name: string): Command;
}
Loading

0 comments on commit a893558

Please sign in to comment.