mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 17:08:21 +08:00
fix argv
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/// <reference path="argv.d.ts" />
|
||||
import argv = require('argv');
|
||||
argv.version( 'v1.0' );
|
||||
argv.info( 'Special script info' );
|
||||
|
||||
59
argv/argv.d.ts
vendored
59
argv/argv.d.ts
vendored
@@ -1,59 +0,0 @@
|
||||
// Type definitions for argv
|
||||
// Project: https://www.npmjs.com/package/argv
|
||||
// Definitions by: Hookclaw <https://github.com/hookclaw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module "argv" {
|
||||
// argv module
|
||||
type args = {
|
||||
targets:string[],
|
||||
options:{[key:string]:any}
|
||||
};
|
||||
|
||||
type helpOption = {
|
||||
name: string,
|
||||
type: string,
|
||||
short?: string,
|
||||
description?: string,
|
||||
example?: string
|
||||
};
|
||||
|
||||
type module = {
|
||||
mod: string,
|
||||
description: string,
|
||||
options: {[key:string]:helpOption}
|
||||
};
|
||||
|
||||
type typeFunction = (value:any, ...arglist:any[]) => any;
|
||||
|
||||
type argv = {
|
||||
|
||||
// Runs the arguments parser
|
||||
run: ( argv?:string[] ) => args,
|
||||
|
||||
// Adding options to definitions list
|
||||
option: ( mod:helpOption|helpOption[] ) => argv,
|
||||
|
||||
// Creating module
|
||||
mod: ( object:module|module[] ) => argv,
|
||||
|
||||
// Creates custom type function
|
||||
type: ( name:string|{[key:string]:typeFunction}, callback?:typeFunction ) => any,
|
||||
|
||||
// Setting version number, and auto setting version option
|
||||
version: ( v:string ) => argv,
|
||||
|
||||
// Description setup
|
||||
info: ( mod:string, description?:module ) => argv,
|
||||
|
||||
// Cleans out current options
|
||||
clear: () => argv,
|
||||
|
||||
// Prints out the help doc
|
||||
help: ( mod?:string ) => argv
|
||||
|
||||
};
|
||||
|
||||
var argv:argv;
|
||||
|
||||
export = argv;
|
||||
}
|
||||
59
argv/index.d.ts
vendored
Normal file
59
argv/index.d.ts
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// Type definitions for argv
|
||||
// Project: https://www.npmjs.com/package/argv
|
||||
// Definitions by: Hookclaw <https://github.com/hookclaw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// argv module
|
||||
type args = {
|
||||
targets: string[],
|
||||
options: { [key: string]: any }
|
||||
};
|
||||
|
||||
type helpOption = {
|
||||
name: string,
|
||||
type: string,
|
||||
short?: string,
|
||||
description?: string,
|
||||
example?: string
|
||||
};
|
||||
|
||||
type module = {
|
||||
mod: string,
|
||||
description: string,
|
||||
options: { [key: string]: helpOption }
|
||||
};
|
||||
|
||||
type typeFunction = (value: any, ...arglist: any[]) => any;
|
||||
|
||||
type argv = {
|
||||
|
||||
// Runs the arguments parser
|
||||
run: (argv?: string[]) => args,
|
||||
|
||||
// Adding options to definitions list
|
||||
option: (mod: helpOption | helpOption[]) => argv,
|
||||
|
||||
// Creating module
|
||||
mod: (object: module | module[]) => argv,
|
||||
|
||||
// Creates custom type function
|
||||
type: (name: string | { [key: string]: typeFunction }, callback?: typeFunction) => any,
|
||||
|
||||
// Setting version number, and auto setting version option
|
||||
version: (v: string) => argv,
|
||||
|
||||
// Description setup
|
||||
info: (mod: string, description?: module) => argv,
|
||||
|
||||
// Cleans out current options
|
||||
clear: () => argv,
|
||||
|
||||
// Prints out the help doc
|
||||
help: (mod?: string) => argv
|
||||
|
||||
};
|
||||
|
||||
declare const argv: argv;
|
||||
|
||||
export = argv;
|
||||
|
||||
19
argv/tsconfig.json
Normal file
19
argv/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"argv-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user